Package org.apache.mina.util.byteaccess
Class ByteArrayList
- java.lang.Object
-
- org.apache.mina.util.byteaccess.ByteArrayList
-
class ByteArrayList extends Object
A linked list that storesByteArrays and maintains several useful invariants. Note : this class is *not* thread safe.- Author:
- Apache MINA Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classByteArrayList.NodeA node within the linked list.
-
Constructor Summary
Constructors Modifier Constructor Description protectedByteArrayList()Creates a new instance of ByteArrayList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFirst(ByteArray ba)Adds the specifiedByteArrayto the beginning of the listvoidaddLast(ByteArray ba)Add the specifiedByteArrayto the end of the listprotected voidaddNode(ByteArrayList.Node nodeToInsert, ByteArrayList.Node insertBeforeNode)Inserts a new node into the list.intfirstByte()ByteArrayList.NodegetFirst()ByteArrayList.NodegetLast()booleanisEmpty()Check to see if this is emptyintlastByte()ByteArrayList.NoderemoveFirst()Removes the first node from this listByteArrayList.NoderemoveLast()Removes the last node in this listprotected ByteArrayList.NoderemoveNode(ByteArrayList.Node node)Removes the specified node from the list.
-
-
-
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
-
getLast
public ByteArrayList.Node getLast()
- Returns:
- the last
ByteArrayList.Nodein the list
-
addFirst
public void addFirst(ByteArray ba)
Adds the specifiedByteArrayto the beginning of the list- Parameters:
ba- The ByteArray to be added to the list
-
addLast
public void addLast(ByteArray ba)
Add the specifiedByteArrayto 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 insertinsertBeforeNode- 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
-
-