Class ByteArrayList

java.lang.Object
org.apache.mina.util.byteaccess.ByteArrayList

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

    • firstByte

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

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

    • ByteArrayList

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

    • 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
    • getLast

      public ByteArrayList.Node getLast()
      Returns:
      the last ByteArrayList.Node in the list
    • 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
    • removeNode

      protected ByteArrayList.Node removeNode(ByteArrayList.Node node)
      Removes the specified node from the list.
      Parameters:
      node - the node to remove