ByteBuffer byteBuf = ByteBuffer.wrap(bytes, offset, numBytes);
CharBuffer charBuf = btc.decode(byteBuf);
// CharBuffer returned by the decoder will set its limit
// to byte immediately after the last written byte.
resultingNumChars = charBuf.limit();
// IMPORTANT - It's possible the underlying char[] in the
// CharBuffer returned by btc.decode(byteBuf)
// is longer in length than the number of characters
// decoded. Hence, the check below to ensure the