|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asyncobjects.io.ByteQueue
public final class ByteQueue
actually JDK 1.4 buffer should be used instead of this one, but there is an intention to make sources compatible with 1.3 and personal profile platform. Also there is only one kind of buffer to simplify compatibility issues. This class is not thread safe.
Constructor Summary | |
---|---|
ByteQueue(int size)
size of buffer |
Method Summary | |
---|---|
int |
availableForGet()
avaiable for get |
int |
availableForPut()
|
int |
capacity()
|
void |
clear()
clear queue from all elements |
int |
get(byte[] buffer)
Get bytes into array |
int |
get(byte[] buffer,
int start,
int length)
Get bytes into array |
boolean |
isEmpty()
|
boolean |
isFull()
|
int |
peek(int offset,
byte[] buffer,
int start,
int length)
Peek bytes |
int |
put(byte[] buffer)
Peek bytes |
int |
put(byte[] buffer,
int start,
int length)
Peek bytes |
void |
skip(int n)
consume some bytes in buffer |
int |
transferFrom(ByteQueue buffer)
transfer data from one buffer to another, this method gets data from first buffer by method gets, so data is consumed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteQueue(int size)
size
- buffer sizeMethod Detail |
---|
public int availableForGet()
public int availableForPut()
public void skip(int n)
n
- amount of bytes to consumepublic int get(byte[] buffer)
buffer
- an target array
public int get(byte[] buffer, int start, int length)
buffer
- an target arraystart
- start position in target arraylength
- maximum amount of bytes to copy
public int peek(int offset, byte[] buffer, int start, int length)
offset
- a position inside databuffer
- a target bufferstart
- a start position in the bufferlength
- max amount to get
public int put(byte[] buffer)
buffer
- a target buffer
public int put(byte[] buffer, int start, int length)
buffer
- a target bufferstart
- a start position in the bufferlength
- max amount to get
public int transferFrom(ByteQueue buffer)
buffer
- source buffer
public boolean isEmpty()
public boolean isFull()
public void clear()
public int capacity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |