Class ByteArrayList


  • class ByteArrayList
    extends java.lang.Object
    A linked list that stores ByteArrays and maintains several useful invariants. Note : this class is *not* thread safe.
    • Field Detail

      • header

        private final ByteArrayList.Node header
        A ByteArrayList.Node which indicates the start and end of the list and does not hold a value. The value of next is the first item in the list. The value of of previous is the last item in the list.
      • firstByte

        private int firstByte
        The first byte in the array list
      • lastByte

        private int lastByte
        The last byte in the array list
    • Constructor Detail

      • ByteArrayList

        protected ByteArrayList()
        Creates a new instance of ByteArrayList.
    • Method Detail

      • lastByte

        public int lastByte()
        Returns:
        The last byte in the array list
      • firstByte

        public int firstByte()
        Returns:
        The first byte in the array list
      • isEmpty

        public boolean isEmpty()
        Check to see if this is empty
        Returns:
        True if empty, otherwise false
      • getFirst

        public ByteArrayList.Node getFirst()
        Returns:
        the first node in the byte array
      • addFirst

        public void addFirst​(ByteArray ba)
        Adds the specified ByteArray to the beginning of the list
        Parameters:
        ba - The ByteArray to be added to the list
      • addLast

        public void addLast​(ByteArray ba)
        Add the specified ByteArray to the end of the list
        Parameters:
        ba - The ByteArray to be added to the list
      • removeFirst

        public ByteArrayList.Node removeFirst()
        Removes the first node from this list
        Returns:
        The node that was removed
      • removeLast

        public ByteArrayList.Node removeLast()
        Removes the last node in this list
        Returns:
        The node that was taken off of the list
      • addNode

        protected void addNode​(ByteArrayList.Node nodeToInsert,
                               ByteArrayList.Node insertBeforeNode)
        Inserts a new node into the list.
        Parameters:
        nodeToInsert - new node to insert
        insertBeforeNode - node to insert before