- All Implemented Interfaces:
A pooled ByteBuffer which maintains a reference count that is
retain() and decremented with
release(). The buffer
is released to the pool when
release() is called one more time than
RetainableByteBuffer can either be:
- in pool; in this case
- out of pool but not retained; in this case
- out of pool and retained; in this case
release() on a out of pool and retained instance does not re-pool it while that re-pools it on a out of pool but not retained instance.
capacitypublic int capacity()
getBufferpublic ByteBuffer getBuffer()
getLastUpdatepublic long getLastUpdate()
isRetainedpublic boolean isRetained()
- true if this buffer is retained, false otherwise.
isDirectpublic boolean isDirect()
retainpublic void retain()Increments the retained counter of this buffer.
releasepublic boolean release()Decrements the retained counter of this buffer.
- true if the buffer was re-pooled, false otherwise.
remainingpublic int remaining()
hasRemainingpublic boolean hasRemaining()
isEmptypublic boolean isEmpty()
clearpublic void clear()
toStringpublic String toString()