Class ByteArrayList
java.lang.Object
org.apache.mina.util.byteaccess.ByteArrayList
A linked list that stores
ByteArrays and maintains several useful invariants.
Note : this class is *not* thread safe.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe first byte in the array listprivate final ByteArrayList.NodeAByteArrayList.Nodewhich indicates the start and end of the list and does not hold a value.private intThe last byte in the array list -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the specifiedByteArrayto the beginning of the listvoidAdd the specifiedByteArrayto the end of the listprotected voidaddNode(ByteArrayList.Node nodeToInsert, ByteArrayList.Node insertBeforeNode) Inserts a new node into the list.intgetFirst()getLast()booleanisEmpty()Check to see if this is emptyintlastByte()Removes the first node from this listRemoves the last node in this listprotected ByteArrayList.NoderemoveNode(ByteArrayList.Node node) Removes the specified node from the list.
-
Field Details
-
header
AByteArrayList.Nodewhich indicates the start and end of the list and does not hold a value. The value ofnextis the first item in the list. The value of ofpreviousis the last item in the list. -
firstByte
private int firstByteThe first byte in the array list -
lastByte
private int lastByteThe 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
- Returns:
- the first node in the byte array
-
getLast
- Returns:
- the last
ByteArrayList.Nodein the list
-
addFirst
-
addLast
-
removeFirst
Removes the first node from this list- Returns:
- The node that was removed
-
removeLast
Removes the last node in this list- Returns:
- The node that was taken off of the list
-
addNode
Inserts a new node into the list.- Parameters:
nodeToInsert- new node to insertinsertBeforeNode- node to insert before
-
removeNode
Removes the specified node from the list.- Parameters:
node- the node to remove
-