Class RetainableByteBuffer

  • All Implemented Interfaces:

    public class RetainableByteBuffer
    extends java.lang.Object
    implements Retainable
    A Retainable ByteBuffer.

    Acquires a ByteBuffer from a ByteBufferPool and maintains a reference count that is initially 1, incremented with retain() and decremented with release(). The buffer is released to the pool when the reference count is decremented to 0.

    • Constructor Detail

      • RetainableByteBuffer

        public RetainableByteBuffer​(ByteBufferPool pool,
                                    int size)
      • RetainableByteBuffer

        public RetainableByteBuffer​(ByteBufferPool pool,
                                    int size,
                                    boolean direct)
    • Method Detail

      • getBuffer

        public java.nio.ByteBuffer getBuffer()
      • getReferences

        public int getReferences()
      • release

        public int release()
      • remaining

        public int remaining()
      • hasRemaining

        public boolean hasRemaining()
      • isEmpty

        public boolean isEmpty()
      • clear

        public void clear()
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object