Class ByteArrayFifo


  • public class ByteArrayFifo
    extends Object
    First in first out byte array queue. The size of the queue should be a multiple of 2 minus one (size = 2^x - 1).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) byte[][] arrays  
      (package private) int head  
      (package private) int size  
      (package private) int tail  
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteArrayFifo​(int size)
      Creates a new ByteArray with size entries.
    • Field Detail

      • arrays

        byte[][] arrays
      • head

        int head
      • tail

        int tail
      • size

        int size
    • Constructor Detail

      • ByteArrayFifo

        public ByteArrayFifo​(int size)
        Creates a new ByteArray with size entries.
        Parameters:
        size - The size of the queue (size = 2^x - 1)
    • 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 one byte array form the queue.
        Returns:
        The removed byte array.
      • reset

        public void reset()
        Clears the queue.
      • availToRead

        public int availToRead()
        Reads the available entries in the queue.
        Returns:
        The available byte arrays 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.