List of utility methods to do ByteBuffer from UTF
void | bufferUTF(String string, ByteBuffer buffer) buffer UTF try { byte[] bytes = string.getBytes("UTF-8"); buffer.put(bytes); buffer.put((byte) 0); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); |
ByteBuffer | byteBufferFromUtf8String(final String data) byte Buffer From Utf String final byte[] bytes = data.getBytes(Charset.forName("UTF-8")); return ByteBuffer.wrap(bytes); |