public class ByteArray extends Object implements Serializable, Comparable<ByteArray>
| Constructor and Description |
|---|
ByteArray()Creates an empty ByteArray. |
ByteArray(byte[] data)Sets valid = data.length, unless data is null
Sets offset = 0 |
ByteArray(byte[] data,
int offset,
int length)Sets offset = offset
Sets valid = length |
| Modifier and Type | Method and Description |
|---|---|
int | compareTo(ByteArray ba)Compares this ByteArray with another ByteArray. |
boolean | equals(Object o)Compares this ByteArray with another object for equality. |
byte[] | getData()Returns the underlying byte array. |
int | getOffset()Returns the offset into the byte array. |
int | getValid()Count how many of the bytes in the array are 'valid'. |
int | hashCode()Hash code based on the underlying byte array data. |
void | setData(byte[] data)Sets the underlying byte array. |
void | setOffset(int offset)Sets the offset into the byte array. |
void | setValid(int valid)Sets the number of valid bytes. |
String | toBase64()Returns this ByteArray as a Base64 encoded string. |
String | toString()Returns a string representation of this ByteArray. |
public ByteArray()
public ByteArray(byte[] data)
data - the byte array, may be nullpublic ByteArray(byte[] data,
int offset,
int length)data - the byte array, may be null but why would you do thatoffset - the starting offsetlength - the valid lengthpublic final int compareTo(ByteArray ba)
compareTo in interface Comparable<ByteArray>public final boolean equals(Object o)
public byte[] getData()
public int getOffset()
public int getValid()
public final int hashCode()
public void setData(byte[] data)
data - the new byte arraypublic void setOffset(int offset)
offset - the new offsetpublic void setValid(int valid)
valid - the new valid countpublic final String toBase64()