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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(byte i) add a new elementboolean
add
(byte[] b) add a new elementboolean
add
(byte[] b, int off, int len) add a new elementvoid
append
(byte b) append list by one byte bvoid
append a byte array list at the endvoid
clear()
clear listbyte
get
(int i) get element at index iboolean
remove
(int i) remove an element from listvoid
set
(int i, byte value) replace element at index i by valuevoid
set
(int i, byte[] b, int off, int len) replace elements starting at index i by len valuesint
size()
get the size of the listint
get 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()
-