List of utility methods to do ByteBuffer to String
String | getStringRepresentation(ByteBuffer key) get String Representation Charset charset = Charset.forName("ISO-8859-1"); CharsetDecoder decoder = charset.newDecoder(); String keyName = null; ByteBuffer keyNameByteBuffer = key.duplicate(); CharBuffer keyNameCharBuffer; try { keyNameCharBuffer = decoder.decode(keyNameByteBuffer); keyName = keyNameCharBuffer.toString(); ... |
String | getStringTrimmed(ByteBuffer buffer, int size) Strings in the file are zero-terminated. return getString(buffer, size).trim();
|
String | getStringWOLength(ByteBuffer bb) get String WO Length byte[] b = new byte[bb.limit()]; bb.get(b); return new String(b, Charset.forName("UTF-8")); |
String | readStr(ByteBuffer bb, int off, int len) read Str return readStr(bb, off, len, OLE_CHARSET);
|
String | readString(byte[] tmp, ByteBuffer in) read String int len = in.get() & 0xff; in.get(tmp, 0, len); return new String(tmp, 0, len, StandardCharsets.UTF_8); |
void | readString(ByteBuffer b, char s[], int off, int len) read String while (off < len) {
s[off++] = b.getChar();
|
String | readString(ByteBuffer bb) read String int len = (int) bb.getShort(); byte[] stringBytes = new byte[len]; bb.get(stringBytes); return new String(stringBytes); |
String | readString(ByteBuffer bb) read String int length = bb.get(); byte strBytes[] = new byte[length]; bb.get(strBytes); try { return new String(strBytes, STORED_ENCODING); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); |
String | readString(ByteBuffer bb, int limit) Reads a null-terminated string from the current position of the given bytebuffer. int max = Math.min(limit, bb.remaining()); byte[] name = new byte[max]; bb.get(name); return readString(name, max); |
String | readString(ByteBuffer buf) read String StringBuilder bldr = new StringBuilder(); char c = (char) buf.get(); while (c != '\0') { bldr.append(c); c = (char) buf.get(); return bldr.toString(); |