The list of methods to do ByteBuffer Decode are organized into topic(s).
CharBuffer
bytesToChars(CharsetDecoder decoder, ByteBuffer bytes, CharBuffer chars) Convert byte buffer's content into characters.
assert decoder.malformedInputAction() == CodingErrorAction.REPORT;
chars = clearAndEnsureCapacity(chars, (int) (bytes.remaining() * decoder.maxCharsPerByte()));
bytes.mark();
decoder.reset();
CoderResult cr = decoder.decode(bytes, chars, true);
if (cr.isError()) {
bytes.reset();
try {
...
String
decode(byte firstByte, ByteBuffer buffer, String charset) decode
int lenOrValue = firstByte & OB_VARCHAR_LEN_MASK;
int strLen = 0;
if (lenOrValue <= OB_MAX_1B_STR_LEN) {
strLen = lenOrValue;
} else {
for (int n = 0; n < lenOrValue - OB_MAX_1B_STR_LEN; n++) {
strLen |= ((buffer.get() & 0xffl) << (n << 3));
byte[] ret = new byte[strLen];
buffer.get(ret);
try {
return new String(ret, charset);
} catch (UnsupportedEncodingException e) {
return "";
String
decode(ByteBuffer bb, CharsetDecoder decoder) decode
CharBuffer cb = CharBuffer.allocate(128);
CoderResult result = decoder.decode((ByteBuffer) bb.flip(), cb, true );
if (result.isError()) {
throw new IllegalArgumentException("Malformed UTF-8!");
return ((CharBuffer) cb.flip()).toString();
void
decodeAlign(ByteBuffer buf) decode Align
final int pos = buf.position();
final int newPos = aligned(pos);
if (buf.limit() < newPos)
throw new BufferUnderflowException();
buf.position(newPos);