public class BlockingByteQueue
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static int |
BLOCK_SIZE |
protected int |
bytes |
protected java.util.concurrent.BlockingQueue<byte[]> |
queue |
protected byte[] |
rbuf |
protected int |
rlen |
protected int |
rpos |
protected byte[] |
wbuf |
protected int |
wlen |
Constructor and Description |
---|
BlockingByteQueue() |
Modifier and Type | Method and Description |
---|---|
int |
available()
Gets the number of bytes available in the buffer.
|
void |
clear()
Clears the queue.
|
int |
read()
Reads a byte from the queue.
|
int |
read(byte[] buf)
Reads a byte array from the queue.
|
byte[] |
readAvailable()
Reads all available data from the queue.
|
byte[] |
readDelimited(byte delimiter)
Reads data from the queue until a delimiter is encountered.
|
void |
write(byte[] buf)
Writes a byte array to the queue.
|
void |
write(int c)
Writes a byte to the queue.
|
protected static final int BLOCK_SIZE
protected java.util.concurrent.BlockingQueue<byte[]> queue
protected byte[] wbuf
protected byte[] rbuf
protected int bytes
protected int wlen
protected int rlen
protected int rpos
public void clear()
public void write(int c)
public void write(byte[] buf)
public int read()
public int read(byte[] buf)
public byte[] readAvailable()
public byte[] readDelimited(byte delimiter)
delimiter
- delimiter byte.public int available()