public static ByteBuffer stringToBytes(String s) {
        try {
            return ByteBuffer.wrap(s.getBytes(Charsets.UTF_8.name()));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
Convert the given string to a byte buffer. The resulting buffer can be
converted back to the same string through {@link #bytesToString(ByteBuffer)}.
indexr-query-opt/src/main/java/org/apache/spark/util/JavaUtils.java