Class CircularByteArray


  • public class CircularByteArray
    extends Object
    Implements a circular byte array.
    Author:
    Lyubomir Marinov
    • Constructor Detail

      • CircularByteArray

        public CircularByteArray​(int length)
        Initializes a new CircularBufferArray instance with a specific length.
        Parameters:
        length - the length i.e. the number of elements of the new instance
    • Method Detail

      • push

        public void push​(byte element)
        Adds a specific element at the end of this CircularByteArray.
        Parameters:
        element - the element to add at the end of this CircularByteArray
      • toArray

        public byte[] toArray()
        Copies the elements of this CircularByteArray into a new byte array.
        Returns:
        a new byte array which contains the same elements and in the same order as this CircularByteArray