public class ByteArray
extends Object
Encapsulates a byte[] and the number of bytes used.
-
-
Constructor Summary
Constructors
Creates a new byte array wrapper.
Creates a new byte array wrapper.
-
Method Summary
boolean
Two ByteArray are equal when they have the same size and each byte
within the first size
bytes are equal.
int
The hashCode is created from the first size
bytes.
-
Field Details
-
EMPTY_BYTE_ARRAY
public static final ByteArray EMPTY_BYTE_ARRAY
-
array
public final byte[] array
-
size
public final int size
-
Constructor Details
-
ByteArray
public ByteArray(byte[] array)
Creates a new byte array wrapper.
-
ByteArray
public ByteArray(byte[] array,
int size)
Creates a new byte array wrapper.
-
Method Details
-
equals
public boolean equals(Object o)
Two ByteArray are equal when they have the same size and each byte
within the first size
bytes are equal.
- Overrides:
equals
in class Object
-
hashCode
public int hashCode()
The hashCode is created from the first size
bytes.
- Overrides:
hashCode
in class Object