Java Utililty Methods ByteBuffer from UTF

List of utility methods to do ByteBuffer from UTF

  1. HOME
  2. Java
  3. B
  4. ByteBuffer from UTF

Description

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

Method

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);

AltStyle によって変換されたページ (->オリジナル) /