Package com.semedy.reasoner.utils
Class ByteArrayList
java.lang.Object
com.semedy.reasoner.utils.ByteArrayList
List for bytes based on arrays
- Author:
- juergen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(byte i) add a new elementbooleanadd(byte[] b) add a new elementbooleanadd(byte[] b, int off, int len) add a new elementvoidappend(byte b) append list by one byte bvoidappend a byte array list at the endvoidclear()clear listbyteget(int i) get element at index ibooleanremove(int i) remove an element from listvoidset(int i, byte value) replace element at index i by valuevoidset(int i, byte[] b, int off, int len) replace elements starting at index i by len valuesintsize()get the size of the listintget the size of the list in bytesbyte[]toArray()returns the base array without copying it
This means also, that there can be irrelevant information at the end.byte[]
-
Constructor Details
-
ByteArrayList
public ByteArrayList()
-
-
Method Details
-
sizeInBytes
public int sizeInBytes()get the size of the list in bytes- Returns:
-
add
add a new element- Parameters:
i- , the element to add- Returns:
- has element been added
- Throws:
IOException
-
add
add a new element- Parameters:
b- , the element to add- Returns:
- has element been added
- Throws:
IOException
-
add
add a new element- Parameters:
b- , the element to addoff- , at offsetlen- , with length len- Returns:
- has element been added
- Throws:
IOException
-
remove
public boolean remove(int i) remove an element from list- Parameters:
i- , element to be removed- Returns:
- element has been removed
-
get
public byte get(int i) get element at index i- Parameters:
i-- Returns:
-
set
public void set(int i, byte value) replace element at index i by value- Parameters:
i- , indexvalue- , new value
-
set
public void set(int i, byte[] b, int off, int len) replace elements starting at index i by len values- Parameters:
i- , indexb- , the new elemtnsoff- , at offsetlen- with length len
-
size
public int size()get the size of the list- Returns:
-
clear
public void clear()clear list -
append
append a byte array list at the end- Parameters:
L- , list to append- Throws:
IOException
-
append
append list by one byte b- Parameters:
b-- Throws:
IOException
-
toArray
public byte[] toArray()returns the base array without copying it
This means also, that there can be irrelevant information at the end.- Returns:
-
toByteArray
public byte[] toByteArray()
-