ByteBuf.nioBuffer

Exposes this buffer's readable bytes as an NIO {@link ByteBuffer}. The returned buffer either share or contains the copied content of this buffer, while changing the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer. This method is identical to {@code buf.nioBuffer(buf.readerIndex(), buf.readableBytes())}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer. Please note that the returned NIO buffer will not see the changes of this buffer if this buffer is a dynamic buffer and it adjusted its capacity.

@throws UnsupportedOperationException if this buffer cannot create a {@link ByteBuffer} that shares the content with itself

@see #nioBufferCount() @see #nioBuffers() @see #nioBuffers(int, int)

  1. ByteBuffer nioBuffer()
    class ByteBuf
    abstract
    ByteBuffer
    nioBuffer
    ()
  2. ByteBuffer nioBuffer(int index, int length)

Meta