public class RetainableByteBuffer extends 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 |
---|---|
void |
clear() |
ByteBuffer |
getBuffer() |
int |
getReferences() |
boolean |
hasRemaining() |
boolean |
isEmpty() |
int |
release() |
int |
remaining() |
void |
retain() |
String |
toString() |
public RetainableByteBuffer(ByteBufferPool pool, int size)
public RetainableByteBuffer(ByteBufferPool pool, int size, boolean direct)
public ByteBuffer getBuffer()
public int getReferences()
public void retain()
retain
in interface Retainable
public int release()
public int remaining()
public boolean hasRemaining()
public boolean isEmpty()
public void clear()
Copyright © 2010 - 2020 Adobe. All Rights Reserved