public class ByteRingBuffer
extends java.lang.Object
| Constructor and Description |
|---|
ByteRingBuffer(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
int |
get()
Get the next byte, block until available.
|
byte[] |
get(int size)
Get several bytes from the queue (size can be any positive).
|
java.lang.String |
getString(int size)
Read bytes from the buffer, blocking untili available, and convert them to the UTF-8 string
|
boolean |
isEmpty() |
void |
put(byte[] buffer)
Put all the bytes to the buffer.
|
void |
put(int value)
put single byte.
|
<T extends java.lang.Number> |
put(java.lang.Iterable<T> collection)
Put all the bytes to the buffer.
|
void |
put(java.lang.String s)
Put string in UTF-8 encoding into the buffer blocking until there is enough space.
|
int |
read()
Nonblocking get the next byte.
|
int |
read(byte[] b)
Nonblocking read.
|
byte[] |
readAll()
Get all data available from the buffer
|
public int get()
public int read()
public void put(int value)
value - public byte[] get(int size)
public void put(byte[] buffer)
buffer - public <T extends java.lang.Number> void put(java.lang.Iterable<T> collection)
collection - public java.lang.String getString(int size)
size - string exact sizepublic void put(java.lang.String s)
s - string to putpublic boolean isEmpty()
public int read(byte[] b)
b - buffer to read intopublic byte[] readAll()