Package org.basex.util.list
Class ByteList
java.lang.Object
org.basex.util.list.ElementList
org.basex.util.list.ByteList
Resizable-array implementation for native bytes.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsFields inherited from class org.basex.util.list.ElementList
factor, size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(byte[] elements) Adds elements to the container.add(byte[] elements, int start, int end) Adds a part of the specified elements to the container.add(int element) Adds an element to the array.booleanbyte[]finish()Returns an array with all elements and invalidates the internal array.final byteget(int index) Returns the element at the specified index position.final byte[]next()Returns an array with all elements and resets the array size.reverse()Reverses the order of the elements.byte[]toArray()Returns an array with all elements.toString()Methods inherited from class org.basex.util.list.ElementList
isEmpty, newCapacity, newCapacity, reset, size, size
-
Field Details
-
list
protected byte[] listElement container.
-
-
Constructor Details
-
ByteList
public ByteList()Default constructor. -
ByteList
public ByteList(long capacity) Constructor with initial array capacity.- Parameters:
capacity- array capacity 3
-
-
Method Details
-
add
Adds an element to the array.- Parameters:
element- element to be added; will be cast to a byte- Returns:
- self reference
-
add
Adds elements to the container.- Parameters:
elements- elements to be added- Returns:
- self reference
-
add
Adds a part of the specified elements to the container.- Parameters:
elements- elements to be addedstart- start positionend- end position- Returns:
- self reference
-
get
public final byte get(int index) Returns the element at the specified index position.- Parameters:
index- index of the element to return- Returns:
- element
-
toArray
public byte[] toArray()Returns an array with all elements.- Returns:
- array
-
next
public final byte[] next()Returns an array with all elements and resets the array size.- Returns:
- array
-
finish
public byte[] finish()Returns an array with all elements and invalidates the internal array. Warning: the function must only be called if the list is discarded afterwards.- Returns:
- array (internal representation!)
-
reverse
Reverses the order of the elements.- Returns:
- self reference
-
equals
-
toString
-