|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ssonet.util.ByteFIFO
Class providing fifo operations using byte array as a buffer
Constructor Summary | |
ByteFIFO(int buffSize)
Creates the FIFO object with the given size of the buffer |
Method Summary | |
int |
available()
|
int |
getBuffSize()
|
int |
read(byte[] readBuffer)
Reads data into a given byte-array. |
int |
read(byte[] readBuffer,
int off,
int blen)
Reads data into a given byte-array. |
byte[] |
read(int byteCount)
Reads an array of bytes from the FIFO |
void |
write(byte[] bytes)
Writes an array of bytes to the FIFO. |
void |
write(byte[] bytes,
int start2,
int length)
Writes length bytes from a byte-array to the FIFO, beginning
with start index. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ByteFIFO(int buffSize)
buffSize
- the buffer sizeMethod Detail |
public void write(byte[] bytes) throws java.io.IOException
bytes
- the array of bytes
java.io.IOException
- if the array doesn't fit into the fifo bufferpublic void write(byte[] bytes, int start2, int length) throws java.io.IOException
length
bytes from a byte-array to the FIFO, beginning
with start
index.
If the start index is greater than the number of bytes in the array, nothing is written.
If start+length is greater than the number of bytes in the array, all bytes beginning at the start index until the end of the array are written.
start2
- the start index in the byte-array for the bytes to be writtenlength
- the number of bytes to be writtenbytes
- the array of bytes
java.io.IOException
- if the number of bytes to be written doesn't fit into the fifo bufferpublic byte[] read(int byteCount) throws java.io.IOException
byteCount
- the number of bytes to read from the fifo
java.io.IOException
- if there are less bytes in the buffer than byteCountpublic int read(byte[] readBuffer)
readBuffer
- buffer for storing the data
public int read(byte[] readBuffer, int off, int blen)
readBuffer
- buffer for storing the dataoff
- Offset which describes at which index to start storing bytes
into the bufferblen
- maximum amount of bytes, which can be stored in the buffer
public int getBuffSize()
public int available()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |