Class SimpleLeakAwareCompositeByteBuf

All Implemented Interfaces:
ByteBufConvertible, ReferenceCounted, Comparable<ByteBuf>, Iterable<ByteBuf>
Direct Known Subclasses:
AdvancedLeakAwareCompositeByteBuf

class SimpleLeakAwareCompositeByteBuf extends WrappedCompositeByteBuf
  • Field Details

  • Constructor Details

  • Method Details

    • release

      public boolean release()
      Description copied from interface: ReferenceCounted
      Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
      Specified by:
      release in interface ReferenceCounted
      Overrides:
      release in class WrappedCompositeByteBuf
      Returns:
      true if and only if the reference count became 0 and this object has been deallocated
    • release

      public boolean release(int decrement)
      Description copied from interface: ReferenceCounted
      Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
      Specified by:
      release in interface ReferenceCounted
      Overrides:
      release in class WrappedCompositeByteBuf
      Returns:
      true if and only if the reference count became 0 and this object has been deallocated
    • closeLeak

      private void closeLeak(ByteBuf trackedByteBuf)
    • order

      public ByteBuf order(ByteOrder endianness)
      Description copied from class: ByteBuf
      Returns a buffer with the specified endianness which shares the whole region, indexes, and marks of this buffer. Modifying the content, the indexes, or the marks of the returned buffer or this buffer affects each other's content, indexes, and marks. If the specified endianness is identical to this buffer's byte order, this method can return this. This method does not modify readerIndex or writerIndex of this buffer.
      Overrides:
      order in class WrappedCompositeByteBuf
    • slice

      public ByteBuf slice()
      Description copied from class: ByteBuf
      Returns a 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.

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

      Overrides:
      slice in class WrappedCompositeByteBuf
    • 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 WrappedCompositeByteBuf
    • 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 WrappedCompositeByteBuf
    • 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 WrappedCompositeByteBuf
    • 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 WrappedCompositeByteBuf
      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 WrappedCompositeByteBuf
    • readSlice

      public ByteBuf readSlice(int length)
      Description copied from class: ByteBuf
      Returns a new slice of this buffer's sub-region starting at the current readerIndex and increases the readerIndex by the size of the new slice (= length).

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

      Overrides:
      readSlice in class WrappedCompositeByteBuf
      Parameters:
      length - the size of the new slice
      Returns:
      the newly created slice
    • readRetainedSlice

      public ByteBuf readRetainedSlice(int length)
      Description copied from class: ByteBuf
      Returns a new retained slice of this buffer's sub-region starting at the current readerIndex and increases the readerIndex by the size of the new slice (= length).

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

      Overrides:
      readRetainedSlice in class WrappedCompositeByteBuf
      Parameters:
      length - the size of the new slice
      Returns:
      the newly created slice
    • asReadOnly

      public ByteBuf asReadOnly()
      Description copied from class: ByteBuf
      Returns a read-only version of this buffer.
      Overrides:
      asReadOnly in class WrappedCompositeByteBuf
    • newLeakAwareByteBuf

      private SimpleLeakAwareByteBuf newLeakAwareByteBuf(ByteBuf wrapped)
    • newLeakAwareByteBuf

      protected SimpleLeakAwareByteBuf newLeakAwareByteBuf(ByteBuf wrapped, ByteBuf trackedByteBuf, ResourceLeakTracker<ByteBuf> leakTracker)