Class ByteLiFo


  • public class ByteLiFo
    extends Object
    Non thread-save last in first out byte queue.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int count  
      (package private) byte[] data  
      (package private) int head  
    • Constructor Summary

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

      • data

        byte[] data
      • head

        int head
      • count

        int count
    • Constructor Detail

      • ByteLiFo

        public ByteLiFo​(int size)
        Creates a new ByteLifo with size entries.
        Parameters:
        size - The size of the queue
    • Method Detail

      • push

        public void push​(byte d)
        Inserts one byte into the LiFo.
        Parameters:
        d - Byte which will be inserted into the LiFo
      • pop

        public byte pop()
        Removes one byte from the LiFo.
        Returns:
        The removed byte
      • clear

        public void clear()
        Clears the LiFo.
      • availToRead

        public int availToRead()
        Reads the available entries in the queue.
        Returns:
        The available bytes to read.
      • compare

        public boolean compare​(byte[] cData,
                               int lifoOffset,
                               int length)
        Compares the LiFo with a byte array.
        Parameters:
        cData - The byte array to compare with the LiFo
        lifoOffset - The start offset of the LiFo
        length - The length of cData
        Returns:
        true if cData and the LiFo are equal, false otherwise