/** * Converts this buffer's readable bytes into a NIO buffer. The returned * buffer shares the content with this buffer. */ public ByteBuffer toByteBuffer() { return toByteBuffer(0, length); }
/** * Decodes this buffer's sub-region into a string with the specified * character set. */ public String toString(int index, int length, Charset charset) { if (length == 0) { return ""; } return Slices.decodeString(toByteBuffer(index, length), charset); }