-
- All Implemented Interfaces:
public class ByteFifoBufferFirst in - first out byte buffer
-
-
Field Summary
Fields Modifier and Type Field Description private intbuffered
-
Constructor Summary
Constructors Constructor Description ByteFifoBuffer(int len)Creates buffer of specified size
-
Method Summary
Modifier and Type Method Description intgetBuffered()intlength()intread(Array<byte> out_buffer, int count)Reads count bytes into out_buffer. intread(Array<byte> out_buffer, int buff_offset, int count)Read with buffer offset intgetWriteRemaining()intwrite(Array<byte> buffer, int count)Writes count of bytes from the buffer intwrite(Array<byte> data, int offset, int count)Writes data into the buffer. voidconsumeWriteBuffer(int count)Advances current buffer's write position by count bytes booleansetCapacity(int new_size)Sets new buffer's capacity voidconsumeReadData(int count)Aligns current read position by count intreadOffset(Array<byte> dst_buff, int dst_buff_offset, int count, int offset)Reads count bytes from buffer without storing new read position intwriteOffset(Array<byte> data, int count, int nOffset)Writes count bytes from data to the buffer without affecting buffer's write position voidresetReadPosition()voidresetWritePosition()-
-
Method Detail
-
getBuffered
int getBuffered()
-
length
int length()
-
read
int read(Array<byte> out_buffer, int count)
Reads count bytes into out_buffer. Current read position is incremented by count of bytes that has been successfully read.
- Parameters:
out_buffer- read count bytes into this buffercount- number of bytes to read into the out_buffer
-
read
int read(Array<byte> out_buffer, int buff_offset, int count)
Read with buffer offset
- Parameters:
out_buffer- read count bytes into this bufferbuff_offset- offset where to start writing into out_buffercount- bytes to read
-
getWriteRemaining
int getWriteRemaining()
-
write
int write(Array<byte> buffer, int count)
Writes count of bytes from the buffer
- Parameters:
buffer- data to write into the buffercount- number of bytes to read from the buffer
-
write
int write(Array<byte> data, int offset, int count)
Writes data into the buffer.
- Parameters:
data- source dataoffset- source buffer's offsetcount- number of bytes to read from the buffer
-
consumeWriteBuffer
void consumeWriteBuffer(int count)
Advances current buffer's write position by count bytes
- Parameters:
count- number of bytes to move forward
-
setCapacity
boolean setCapacity(int new_size)
Sets new buffer's capacity
- Parameters:
new_size- number of bytes
-
consumeReadData
void consumeReadData(int count)
Aligns current read position by count
- Parameters:
count- number of bytes to move the read position
-
readOffset
int readOffset(Array<byte> dst_buff, int dst_buff_offset, int count, int offset)
Reads count bytes from buffer without storing new read position
- Parameters:
dst_buff- buffer to write the read data todst_buff_offset- offset of destination buffercount- bytes to readoffset- from current read position
-
writeOffset
int writeOffset(Array<byte> data, int count, int nOffset)
Writes count bytes from data to the buffer without affecting buffer's write position
- Parameters:
data- the data to write to the buffercount- number of bytes to read from datanOffset- from buffer's write position
-
resetReadPosition
void resetReadPosition()
-
resetWritePosition
void resetWritePosition()
-
-
-
-