public class OutByteBuffer extends java.lang.Object implements IOutByteBuffer
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
Default output buffer size.
|
| Constructor and Description |
|---|
OutByteBuffer()
Constructor using default buffer size.
|
OutByteBuffer(int size)
Constructor with size specified.
|
| Modifier and Type | Method and Description |
|---|---|
void |
finish()
Complete usage of the current stream.
|
void |
flush()
Empty the buffer.
|
void |
free(int reserve,
int size)
Free at least some number of bytes of space in the byte array.
|
byte[] |
getBuffer()
Get the byte array buffer.
|
int |
getOffset()
Get the index of the next byte to be read.
|
void |
reset()
Reset to initial state for reuse.
|
void |
setOffset(int offset)
Set the current offset.
|
void |
setOutput(java.io.OutputStream os)
Set output stream.
|
public static final int DEFAULT_BUFFER_SIZE
public OutByteBuffer(int size)
size - initial buffer size in bytespublic OutByteBuffer()
public void reset()
public void setOutput(java.io.OutputStream os)
os - streampublic byte[] getBuffer()
getBuffer in interface IByteBufferpublic int getOffset()
setOffset(int) method must be used to update the current offset before
any other operations are performed on the buffer.getOffset in interface IByteBufferpublic void setOffset(int offset)
setOffset in interface IByteBufferoffset - public void free(int reserve,
int size)
throws java.io.IOException
getBuffer() and IByteBuffer.getOffset() must always be called
again before any further use of the buffer.free in interface IOutByteBufferreserve - offset of data to be preserved in buffer (nothing
preserved if greater than or equal to current offset)size - desired number of bytesjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface IOutByteBufferjava.io.IOExceptionpublic void finish()
throws java.io.IOException
setOutput(OutputStream) is
required before the buffer can again be used.finish in interface IByteBufferjava.io.IOException