public class ByteArrayWrapper extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<ByteArrayWrapper>
hashCode()
and equals(Object)
, so byte arrays can be used,
e.g., in a HashMap. The class is immutable. Custom (de)serialization is
provided to make this efficient to use in storage or RMI scenarios.Modifier and Type | Class and Description |
---|---|
static class |
ByteArrayWrapper.Comparator
Comparator for
ByteArrayWrapper . |
Modifier and Type | Field and Description |
---|---|
protected byte[] |
array
The wrapped array.
|
Constructor and Description |
---|
ByteArrayWrapper(byte[] array)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ByteArrayWrapper o) |
boolean |
equals(java.lang.Object obj) |
byte[] |
getBytes()
Returns a copy of the internal byte representation.
|
int |
hashCode() |
java.lang.String |
toString() |
protected byte[] array
public ByteArrayWrapper(byte[] array)
public byte[] getBytes()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(ByteArrayWrapper o)
compareTo
in interface java.lang.Comparable<ByteArrayWrapper>