public class ByteList extends PrimitiveList
The decodeString(java.nio.charset.Charset) and decodeUtf8() convenience methods
provide an efficient and Unicode-compliant way to build
a String from bytes.
| Constructor and Description |
|---|
ByteList()
Constructs a new list.
|
ByteList(byte[] array)
Constructs a new list initialised to the contents of a given array.
|
ByteList(int size)
Constructs a new list with a given initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(byte value)
Appends a value to the end of this list.
|
boolean |
addAll(byte[] array)
Appends all the elements of a primitive array to this list.
|
boolean |
addAll(ByteList other)
Appends all the elements of a second list to this list.
|
String |
decodeString(Charset charset)
Returns a string with the current byte content of this byte list,
decoded using the supplied encoding.
|
String |
decodeUtf8()
Returns a string with the current byte content of this byte list,
decoded using the UTF-8 encoding.
|
byte |
get(int i)
Returns the element at a given position.
|
byte[] |
getByteBuffer()
Returns the array currently used to store the contents of this list.
|
void |
set(int i,
byte value)
Sets the element at a given position.
|
byte[] |
toByteArray()
Returns the contents of this list as an array.
|
clear, nextCapacity, size, toArraypublic ByteList()
public ByteList(int size)
size - initial capacitypublic ByteList(byte[] array)
array - array whose contents form initial contents of listpublic byte get(int i)
i - indexipublic void set(int i,
byte value)
i - indexvalue - new value for element ipublic void add(byte value)
value - value to appendpublic boolean addAll(ByteList other)
other - other listpublic boolean addAll(byte[] array)
array - array to appendpublic byte[] toByteArray()
public byte[] getByteBuffer()
public String decodeString(Charset charset)
charset - character setpublic String decodeUtf8()
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.