public class XBByteArray
extends java.lang.Object
Constructor and Description |
---|
XBByteArray() |
XBByteArray(byte[] initialData)
Create XBByteArray object using the given array as its initial
array.
|
XBByteArray(int initialCapacity)
Create XBByteArray object with the given initial capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(byte value)
Add given value to end of buffer.
|
java.lang.Object |
clone()
Return a copy of this object.
|
int |
compareTo(java.lang.Object obj)
Compare two XBByteArray objects.
|
void |
ensureCapacity(int capacity)
Ensure the buffer is at least the given size.
|
void |
ensureCapacity(int capacity,
int preserveLength)
Ensure the buffer's length is at least the given capacity.
|
byte |
get(int index)
Return value at given index.
|
void |
initialize(int capacity)
Initialize the buffer so that:
capacity is at least as given
size is set to given capacity
0..size-1 are initialized
|
byte[] |
internalArray()
Get the internal array.
|
void |
reset()
Reset size to 0.
|
void |
setInternalArray(byte[] newBuffer,
int size)
Give this object a new array to manage.
|
int |
size()
Return the number of valid bytes in the array.
|
byte[] |
toArray()
Return a newly allocated array, holding the data from this object.
|
java.lang.String |
toString()
Provides a hex binary representation of the string.
|
void |
writeToStream(java.io.OutputStream stream)
Write the data of this array to the given stream.
|
public XBByteArray()
public XBByteArray(int initialCapacity)
initialCapacity
- public XBByteArray(byte[] initialData)
initialData
- public byte[] internalArray()
public java.lang.Object clone()
clone
in class java.lang.Object
public int compareTo(java.lang.Object obj)
obj
- public void add(byte value)
value
- public void ensureCapacity(int capacity, int preserveLength)
capacity
- preserveLength
- java.lang.ArrayIndexOutOfBoundsException
- if preserveLength < 0 or
preserveLength > size.public void ensureCapacity(int capacity)
capacity
- public byte get(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index < 0 or index >= size()public void initialize(int capacity)
public void setInternalArray(byte[] newBuffer, int size)
newBuffer
- The new buffer to manage.size
- The new size (0..newBuffer.length)public void reset()
public int size()
public byte[] toArray()
public java.lang.String toString()
toString
in class java.lang.Object
public void writeToStream(java.io.OutputStream stream) throws java.io.IOException
java.io.IOException