|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.asn1.ber.digester.rules.ByteAccumulator
Gathers bytes from buffers while dynamically growing to accomodate a new size.
Field Summary | |
private byte[] |
bs
the accumulator's backing store |
private static int |
DEFAULT_INCREMENT
the default initial size |
private static int |
DEFAULT_INIT_SIZE
the default initial size |
private int |
increment
the growth increment used to augment the backing store |
private int |
initial
the initial size of the backing store |
private int |
pos
the current position of the accumulator |
Constructor Summary | |
|
ByteAccumulator()
Creates a ByteAccumulator used to gather bytes from various sources with a default initial size and a default growth increment. |
(package private) |
ByteAccumulator(int initial)
Creates a ByteAccumulator used to gather bytes from various sources with a default initial size and a default growth increment. |
Method Summary | |
java.nio.ByteBuffer |
drain()
Wraps a ByteBuffer around the populated bytes of this ByteAccumulator and resets the backing store to a newly allocated byte array of initial size. |
java.nio.ByteBuffer |
drain(int initial)
Wraps a ByteBuffer around the populated bytes of this ByteAccumulator and resets the backing store to a newly allocated byte array of initial size. |
void |
ensureCapacity(int capacity)
Allocates memory to handle a capacity without the need to grow. |
void |
fill(java.nio.ByteBuffer buf)
Fills this accumulator with the content of the argument buffer into this accumulator. |
int |
getCapacity()
The current capacity of the backing store which may change as this accumulator is filled with bytes. |
int |
getGrowthIncrement()
The growth increment by which the backing store is augmented. |
int |
getInitialSize()
The initial size of the backing store. |
int |
getPosition()
The current position within the backing store marking the point to which this accumulator is filled. |
int |
getRemainingSpace()
The remaining free space that can be filled before having to grow the backing store of the accumulator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int DEFAULT_INIT_SIZE
private static final int DEFAULT_INCREMENT
private byte[] bs
private int pos
private int increment
private int initial
Constructor Detail |
public ByteAccumulator()
ByteAccumulator(int initial)
initial
- the initial size for the backing storeMethod Detail |
public void fill(java.nio.ByteBuffer buf)
buf
- the buffer to fill into this accumulatorpublic java.nio.ByteBuffer drain()
public java.nio.ByteBuffer drain(int initial)
public void ensureCapacity(int capacity)
capacity
- the capacity to hold without the need to growpublic int getGrowthIncrement()
public int getInitialSize()
public int getCapacity()
public int getRemainingSpace()
public int getPosition()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |