public class ByteQueue
extends java.lang.Object
Constructor and Description |
---|
ByteQueue() |
ByteQueue(byte[] buf,
int off,
int len) |
ByteQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
void |
addData(byte[] buf,
int off,
int len)
Add some data to our buffer.
|
int |
available() |
void |
copyTo(java.io.OutputStream output,
int length)
Copy some bytes from the beginning of the data to the provided
OutputStream . |
static int |
nextTwoPow(int i) |
void |
read(byte[] buf,
int offset,
int len,
int skip)
Read data from the buffer.
|
void |
read(java.nio.ByteBuffer buf,
int len,
int skip)
Read data from the buffer.
|
int |
readInt32() |
int |
readUint16(int skip) |
short |
readUint8(int skip) |
void |
removeData(byte[] buf,
int off,
int len,
int skip)
Remove data from the buffer.
|
void |
removeData(java.nio.ByteBuffer buf,
int len,
int skip)
Remove data from the buffer.
|
void |
removeData(int i)
Remove some bytes from our data from the beginning.
|
byte[] |
removeData(int len,
int skip) |
void |
shrink() |
public ByteQueue()
public ByteQueue(int capacity)
public ByteQueue(byte[] buf, int off, int len)
public static int nextTwoPow(int i)
public void addData(byte[] buf, int off, int len)
buf
- A byte-array to read data from.off
- How many bytes to skip at the beginning of the array.len
- How many bytes to read from the array.public int available()
public void copyTo(java.io.OutputStream output, int length) throws java.io.IOException
OutputStream
.output
- The OutputStream
to copy the bytes to.length
- How many bytes to copy.java.io.IOException
public void read(byte[] buf, int offset, int len, int skip)
buf
- The buffer where the read data will be copied to.offset
- How many bytes to skip at the beginning of buf.len
- How many bytes to read at all.skip
- How many bytes from our data to skip.public void read(java.nio.ByteBuffer buf, int len, int skip)
buf
- The ByteBuffer
where the read data will be copied to.len
- How many bytes to read at all.skip
- How many bytes from our data to skip.public int readInt32()
public short readUint8(int skip)
public int readUint16(int skip)
public void removeData(int i)
i
- How many bytes to remove.public void removeData(byte[] buf, int off, int len, int skip)
buf
- The buffer where the removed data will be copied to.off
- How many bytes to skip at the beginning of buf.len
- How many bytes to read at all.skip
- How many bytes from our data to skip.public void removeData(java.nio.ByteBuffer buf, int len, int skip)
buf
- The ByteBuffer
where the removed data will be copied to.len
- How many bytes to read at all.skip
- How many bytes from our data to skip.public byte[] removeData(int len, int skip)
public void shrink()