Class AbstractPooledDerivedByteBuf.PooledNonRetainedDuplicateByteBuf

    • Field Detail

    • Method Detail

      • duplicate

        public ByteBuf duplicate()
        Description copied from class: ByteBuf
        Returns a buffer which shares the whole region of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modify readerIndex or writerIndex of this buffer.

        The reader and writer marks will not be duplicated. Also be aware that this method will NOT call ByteBuf.retain() and so the reference count will NOT be increased.

        Overrides:
        duplicate in class AbstractByteBuf
        Returns:
        A buffer whose readable content is equivalent to the buffer returned by ByteBuf.slice(). However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the underlying content if necessary.
      • retainedDuplicate

        public ByteBuf retainedDuplicate()
        Description copied from class: ByteBuf
        Returns a retained buffer which shares the whole region of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical to buf.slice(0, buf.capacity()). This method does not modify readerIndex or writerIndex of this buffer.

        Note that this method returns a retained buffer unlike ByteBuf.slice(int, int). This method behaves similarly to duplicate().retain() except that this method may return a buffer implementation that produces less garbage.

        Overrides:
        retainedDuplicate in class AbstractByteBuf
      • slice

        public ByteBuf slice​(int index,
                             int length)
        Description copied from class: ByteBuf
        Returns a slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modify readerIndex or writerIndex of this buffer.

        Also be aware that this method will NOT call ByteBuf.retain() and so the reference count will NOT be increased.

        Overrides:
        slice in class DuplicatedByteBuf
      • retainedSlice

        public ByteBuf retainedSlice()
        Description copied from class: ByteBuf
        Returns a retained slice of this buffer's readable bytes. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical to buf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.

        Note that this method returns a retained buffer unlike ByteBuf.slice(). This method behaves similarly to slice().retain() except that this method may return a buffer implementation that produces less garbage.

        Overrides:
        retainedSlice in class AbstractByteBuf
      • retainedSlice

        public ByteBuf retainedSlice​(int index,
                                     int length)
        Description copied from class: ByteBuf
        Returns a retained slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modify readerIndex or writerIndex of this buffer.

        Note that this method returns a retained buffer unlike ByteBuf.slice(int, int). This method behaves similarly to slice(...).retain() except that this method may return a buffer implementation that produces less garbage.

        Overrides:
        retainedSlice in class AbstractByteBuf