public class RetainableByteBuffer extends java.lang.Object implements Retainable
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 and Description |
|---|
RetainableByteBuffer(ByteBufferPool pool,
int size) |
RetainableByteBuffer(ByteBufferPool pool,
int size,
boolean direct) |
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
getBuffer() |
int |
getReferences() |
boolean |
hasRemaining() |
boolean |
isEmpty() |
int |
release() |
void |
retain() |
java.lang.String |
toString() |
public RetainableByteBuffer(ByteBufferPool pool, int size)
public RetainableByteBuffer(ByteBufferPool pool, int size, boolean direct)
public java.nio.ByteBuffer getBuffer()
public int getReferences()
public void retain()
retain in interface Retainablepublic int release()
public boolean hasRemaining()
public boolean isEmpty()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 1995–2023 Webtide. All rights reserved.