Package org.deepjava.runtime.util
Class ByteArrayFifo
- java.lang.Object
-
- org.deepjava.runtime.util.ByteArrayFifo
-
public class ByteArrayFifo extends Object
First in first outbytearray queue. The size of the queue should be a multiple of 2 minus one (size = 2^x - 1).
-
-
Constructor Summary
Constructors Constructor Description ByteArrayFifo(int size)Creates a newByteArraywithsizeentries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailToRead()Reads the available entries in the queue.intavailToWrite()Reads the available space left in the queue.byte[]dequeue()Removes onebytearray form the queue.voidenqueue(byte[] data)Inserts one byte array into the queue.intgetSize()Reads the maximum number of entries in the queue.voidreset()Clears the queue.
-
-
-
Method Detail
-
enqueue
public void enqueue(byte[] data)
Inserts one byte array into the queue.- Parameters:
data- array which will be inserted into the queue
-
dequeue
public byte[] dequeue()
Removes onebytearray form the queue.- Returns:
- The removed
bytearray.
-
reset
public void reset()
Clears the queue.
-
availToRead
public int availToRead()
Reads the available entries in the queue.- Returns:
- The available
bytearrays to read.
-
availToWrite
public int availToWrite()
Reads the available space left in the queue.- Returns:
- The available queue space.
-
getSize
public int getSize()
Reads the maximum number of entries in the queue.- Returns:
- The size of the queue.
-
-