Package de.aristaflow.adept2.util
Class ArrayTools.ByteArrayWrapper
- java.lang.Object
-
- de.aristaflow.adept2.util.ArrayTools.ByteArrayWrapper
-
- Enclosing class:
- ArrayTools
public static class ArrayTools.ByteArrayWrapper extends Object
A wrapper for byte arrays that provide a useful (i. e. deep)equals(Object)
,hashCode()
andtoString()
.
Equality requires the objects to be compared to beByteArrayWrapper
. Only then the arrays will be unwrapped and compared. Comparing aByteArrayWrapper
with a normal byte array will yieldfalse
.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
array
The wrapped array.
-
Constructor Summary
Constructors Constructor Description ByteArrayWrapper(byte[] array)
Creates a new wrapped array for designated array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
byte[]
getArray()
Gets the wrapped array.int
hashCode()
String
toString()
-
-
-
Constructor Detail
-
ByteArrayWrapper
public ByteArrayWrapper(byte[] array)
Creates a new wrapped array for designated array. This does not clone the array, so beware of side-effects! Changing elements of the array will also change the implementedhashCode()
andequals(Object)
.- Parameters:
array
- The array to be wrapped. This does not clone the array, so beware of side-effects!
-
-
Method Detail
-
getArray
public byte[] getArray()
Gets the wrapped array. This is not a clone, so beware of side-effects! Changing elements of the array will also change the implementedhashCode()
andequals(Object)
.- Returns:
- The wrapped array. This is not a clone, so beware of side-effects!
-
-