Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.emory.mathcs.util.allocator
Class Allocator.Buffer  view Allocator.Buffer download Allocator.Buffer.java

java.lang.Object
  extended byedu.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.


Field Summary
protected  byte[] data
           
private  int refcount
           
protected  int size
           
 
Constructor Summary
protected Allocator.Buffer(byte[] data, int size)
           
 
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
 

Field Detail

data

protected final byte[] data

size

protected final int size

refcount

private int refcount
Constructor Detail

Allocator.Buffer

protected Allocator.Buffer(byte[] data,
                           int size)
Method Detail

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()