java.lang.Object
edu.emory.mathcs.util.allocator.Allocator.Buffer
- Direct Known Subclasses:
- PoolingAllocator.Buffer
- Enclosing class:
- Allocator
- public abstract static class Allocator.Buffer
- extends java.lang.Object
Represents the data buffer returned to the application as a result of
allocate() request. Contains actual byte[] array and the size
value. Users should access only the [0..size] region of the array,
since the initial content of the remaining part is undefined.
Method Summary |
void |
addRef()
Increase reference count on this buffer. |
byte[] |
getData()
Returns the data array encapsulated in this buffer. |
int |
getSize()
Returns the size of this buffer. |
protected abstract void |
reclaim()
|
void |
releaseRef()
Decrease the reference count on this buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
data
protected final byte[] data
size
protected final int size
refcount
private int refcount
Allocator.Buffer
protected Allocator.Buffer(byte[] data,
int size)
getData
public byte[] getData()
- Returns the data array encapsulated in this buffer.
getSize
public int getSize()
- Returns the size of this buffer. The length of the array
encapsulated in this buffer can be larger than that value, but
users are expected to access only the [0..size] region of the
array.
addRef
public void addRef()
- Increase reference count on this buffer.
releaseRef
public void releaseRef()
- Decrease the reference count on this buffer. When the reference
count reaches 0, the buffer may be reclaimed by the allocator
and results of any further usage of that buffer are undefined.
reclaim
protected abstract void reclaim()