List of utility methods to do ByteBuffer to UTF
String | readUTF(ByteBuffer bb) Reads from the bytebuffer bb a representation of a Unicode character string encoded in modified UTF-8 format; this string of characters is then returned as a String .
int utflen = readUnsignedShort(bb); byte[] bytearr = new byte[utflen]; char[] chararr = new char[utflen]; int c, char2, char3; int count = 0; int chararr_count = 0; bb.get(bytearr); while (count < utflen) { ... |
String | readUTF8(ByteBuffer buf) read UTF short len = buf.getShort(); byte[] str = new byte[len]; buf.get(str); String res = null; try { res = new String(str, "UTF-8"); } catch (UnsupportedEncodingException ex) { res = ""; ... |
String | readUTFString(MappedByteBuffer mmap) read UTF String byte[] encodedString = new byte[mmap.getShort()]; mmap.get(encodedString); return new String(encodedString, Charset.forName("UTF-8")); |
CharBuffer | toUtf8CharBuffer(ByteBuffer buffer) Converts the input ByteBuffer in an UTF-8 CharBuffer . return UTF_8.decode(buffer);
|
String | toUtf8String(ByteBuffer buffer) to Utf String if (!buffer.hasRemaining()) { return EMPTY; if (buffer.hasArray()) { return new String(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining(), StandardCharsets.UTF_8); } else { byte[] content = new byte[buffer.remaining()]; ... |
String | toUTF8String(ByteBuffer buffer) Convert the buffer to an UTF-8 String return toString(buffer, StandardCharsets.UTF_8);
|
String | toUtf8String(ByteBuffer byteBuffer) to Utf String byte[] bytes = new byte[byteBuffer.remaining()]; byteBuffer.get(bytes); return new String(bytes, UTF_8); |