Package org.eclipse.jetty.io
Class RetainableByteBuffer
- java.lang.Object
-
- org.eclipse.jetty.io.RetainableByteBuffer
-
- All Implemented Interfaces:
Retainable
public class RetainableByteBuffer extends java.lang.Object implements Retainable
A Retainable ByteBuffer.Acquires a ByteBuffer from a
ByteBufferPooland maintains a reference count that is initially 1, incremented withretain()and decremented withrelease(). The buffer is released to the pool when the reference count is decremented to 0.
-
-
Constructor Summary
Constructors Constructor Description RetainableByteBuffer(ByteBufferPool pool, int size)RetainableByteBuffer(ByteBufferPool pool, int size, boolean direct)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()java.nio.ByteBuffergetBuffer()intgetReferences()booleanhasRemaining()booleanisEmpty()intrelease()intremaining()voidretain()java.lang.StringtoString()
-
-
-
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()
-
retain
public void retain()
- Specified by:
retainin interfaceRetainable
-
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()
- Overrides:
toStringin classjava.lang.Object
-
-