public class GrowableByteBuffer
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| protected byte[] | bufferThe buffer | 
| protected static int | GROWTH_EXPONENTBuffer growth aggressiveness. | 
| protected static int | INITIAL_SIZEInitial buffer size. | 
| protected int | posCurrent position | 
| static byte[] | ZERO_BYTEConstant for a single zero byte. | 
| Constructor and Description | 
|---|
| GrowableByteBuffer()Creates an empty buffer. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | allocateSpace(int length)Allocates a minimum amount of free space in the buffer. | 
| byte[] | getBufferAccess()Direct buffer access, handle with care. | 
| java.nio.ByteBuffer | getByteBuffer(int length)Reserves a byte buffer. | 
| int | getPosition()Returns the position in the buffer that is next written to. | 
| protected void | reserveSpace(int length)Reserves a minimum amount of free space in the buffer and shifts the position past it. | 
| byte[] | toByteArray() | 
| void | write(byte b)Writes a byte, appending it to the buffer. | 
| void | write(byte[] b)Writes a byte array, appending it to the buffer. | 
| void | writeTo(int p,
       byte b)Writes a single byte to a position in the buffer. | 
protected static final int INITIAL_SIZE
protected static final int GROWTH_EXPONENT
public static final byte[] ZERO_BYTE
protected byte[] buffer
protected int pos
public void write(byte b)
b - The byte.public void write(byte[] b)
b - The byte array.public java.nio.ByteBuffer getByteBuffer(int length)
public void writeTo(int p,
                    byte b)
p - The position.b - The byte.public int getPosition()
public byte[] getBufferAccess()
protected void reserveSpace(int length)
public byte[] toByteArray()
protected void allocateSpace(int length)