Package uk.ac.starlink.util
Class ByteList
- java.lang.Object
-
- uk.ac.starlink.util.PrimitiveList
-
- uk.ac.starlink.util.ByteList
-
public class ByteList extends PrimitiveList
Extendable array of bytes.- Since:
- 12 Oct 2006
- Author:
- Mark Taylor
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(byte value)
Appends a value to the end of this list.byte
get(int i)
Returns the element at a given position.void
set(int i, byte value)
Sets the element at a given position.byte[]
toByteArray()
Returns the contents of this list as an array.-
Methods inherited from class uk.ac.starlink.util.PrimitiveList
nextCapacity, size, toArray
-
-
-
-
Constructor Detail
-
ByteList
public ByteList()
Constructs a new list.
-
ByteList
public ByteList(int size)
Constructs a new list with a given initial capacity.- Parameters:
size
- initial capacity
-
ByteList
public ByteList(byte[] array)
Constructs a new list initialised to the contents of a given array.- Parameters:
array
- array whose contents form initial contents of list
-
-
Method Detail
-
get
public byte get(int i)
Returns the element at a given position.- Parameters:
i
- index- Returns:
- element at
i
-
set
public void set(int i, byte value)
Sets the element at a given position.- Parameters:
i
- indexvalue
- new value for elementi
-
add
public void add(byte value)
Appends a value to the end of this list.- Parameters:
value
- value to append
-
toByteArray
public byte[] toByteArray()
Returns the contents of this list as an array.- Returns:
- copy of list contents
-
-