Java Utililty Methods ByteBuffer from UTF

List of utility methods to do ByteBuffer from UTF

Description

The list of methods to do ByteBuffer from UTF are organized into topic(s).

Method

voidbufferUTF(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);
ByteBufferbyteBufferFromUtf8String(final String data)
byte Buffer From Utf String
final byte[] bytes = data.getBytes(Charset.forName("UTF-8"));
return ByteBuffer.wrap(bytes);