Class AbstractPooledDerivedByteBuf

    • Field Detail

      • parent

        private ByteBuf parent
        Deallocations of a pooled derived buffer should always propagate through the entire chain of derived buffers. This is because each pooled derived buffer maintains its own reference count and we should respect each one. If deallocations cause a release of the "root parent" then then we may prematurely release the underlying content before all the derived buffers have been released.
    • Method Detail

      • parent

        final void parent​(ByteBuf newParent)
      • unwrap

        public final AbstractByteBuf unwrap()
        Description copied from class: ByteBuf
        Return the underlying buffer instance if this buffer is a wrapper of another buffer.
        Specified by:
        unwrap in class ByteBuf
        Returns:
        null if this buffer is not a wrapper
      • order

        @Deprecated
        public final java.nio.ByteOrder order()
        Deprecated.
        Description copied from class: ByteBuf
        Returns the endianness of this buffer.
        Specified by:
        order in class ByteBuf
      • isReadOnly

        public boolean isReadOnly()
        Description copied from class: ByteBuf
        Returns true if and only if this buffer is read-only.
        Overrides:
        isReadOnly in class AbstractByteBuf
      • isDirect

        public final boolean isDirect()
        Description copied from class: ByteBuf
        Returns true if and only if this buffer is backed by an NIO direct buffer.
        Specified by:
        isDirect in class ByteBuf
      • array

        public byte[] array()
        Description copied from class: ByteBuf
        Returns the backing byte array of this buffer.
        Specified by:
        array in class ByteBuf
      • hasMemoryAddress

        public boolean hasMemoryAddress()
        Description copied from class: ByteBuf
        Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data.
        Specified by:
        hasMemoryAddress in class ByteBuf
      • isContiguous

        public boolean isContiguous()
        Description copied from class: ByteBuf
        Returns true if this ByteBuf implementation is backed by a single memory region. Composite buffer implementations must return false even if they currently hold ≤ 1 components. For buffers that return true, it's guaranteed that a successful call to ByteBuf.discardReadBytes() will increase the value of ByteBuf.maxFastWritableBytes() by the current readerIndex.

        This method will return false by default, and a false return value does not necessarily mean that the implementation is composite or that it is not backed by a single memory region.

        Overrides:
        isContiguous in class ByteBuf
      • internalNioBuffer

        public final java.nio.ByteBuffer internalNioBuffer​(int index,
                                                           int length)
        Description copied from class: ByteBuf
        Internal use only: Exposes the internal NIO buffer.
        Specified by:
        internalNioBuffer in class ByteBuf
      • retainedSlice

        public final 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
      • 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 AbstractByteBuf
      • duplicate0

        final ByteBuf duplicate0()