public abstract class ByteArrayHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.io.ByteArrayOutputStream |
baos
Large message data holder
|
private java.nio.ByteBuffer |
bb
Work buffer.
|
private int |
len
The length of the next chunk.
|
private int |
remaining
Bytes to be read in a large message
|
private boolean |
trace
Trace operations' flag
|
Constructor and Description |
---|
ByteArrayHandler(int bufsize,
boolean trace)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private boolean |
next()
Try to extract a next chunk from the input
|
int |
nextChunk(java.nio.ByteBuffer chunk)
Process the next portion of input
|
protected abstract void |
ready(byte[] data)
Process the byte portion of the next chunk
|
private volatile java.nio.ByteBuffer bb
private final boolean trace
private volatile int len
private volatile int remaining
private volatile java.io.ByteArrayOutputStream baos
public ByteArrayHandler(int bufsize, boolean trace)
bufsize
- max incoming portion sizetrace
- trace operations flagpublic int nextChunk(java.nio.ByteBuffer chunk)
chunk
- input dataprotected abstract void ready(byte[] data)
data
- the byte portion of the next chunkprivate boolean next()
true
if a new chunk was found