public class ByteArray
extends java.lang.Object
implements java.io.Serializable
This module is a utility class to work with byte arrays. It performs initialization, copies and compares byte arrays.
Constructor and Description |
---|
ByteArray(byte[] barray)
Default constructor
Returns a ByteArray given a byte[]
|
Modifier and Type | Method and Description |
---|---|
static boolean |
compare(byte[] a,
byte[] b)
The
compare method compares the byte arrays for equality. |
static void |
copy(byte[] from,
int offsetFrom,
int len,
byte[] to,
int offsetTo)
The
copy method copies data of length len
from the array from to the array to ,
from the offset offsetFrom to the offset offsetTo . |
boolean |
equals(java.lang.Object arrayObj)
The
equals method determines if the
array object passed in is equal to another array. |
byte[] |
getArray()
The
getArray method returns a byte array
of type byte []. |
int |
hashCode()
The
hashCode method determines the hash of an array. |
static void |
initialize(byte[] array,
byte val)
The
initialize method initializes the array to a given value. |
void |
setArray(byte[] array)
The
setArray method sets the byte array
of type byte[]. |
static byte[] |
XOR(byte[] a,
byte b)
The
XOR method performs the xor function of two byte arrays. |
public ByteArray(byte[] barray)
Default constructor
Returns a ByteArray given a byte[]the
- array to convert into ByteArraypublic byte[] getArray()
The getArray
method returns a byte array
of type byte [].
public void setArray(byte[] array)
The setArray
method sets the byte array
of type byte[].
the
- byte[] arraypublic boolean equals(java.lang.Object arrayObj)
The equals
method determines if the
array object passed in is equal to another array.
equals
in class java.lang.Object
the
- array objectpublic int hashCode()
The hashCode
method determines the hash of an array.
hashCode
in class java.lang.Object
public static void initialize(byte[] array, byte val)
The initialize
method initializes the array to a given value.
the
- array to initializethe
- valuepublic static void copy(byte[] from, int offsetFrom, int len, byte[] to, int offsetTo)
The copy
method copies data of length len
from the array from
to the array to
,
from the offset offsetFrom
to the offset offsetTo
.
the
- input arraythe
- offset for the input arraythe
- length to copythe
- output arraythe
- offset for the output arraypublic static boolean compare(byte[] a, byte[] b)
compare
method compares the byte arrays for equality.first
- byte arraysecond
- byte arraypublic static byte[] XOR(byte[] a, byte b)
XOR
method performs the xor function of two byte arrays.first
- byte arraysecond
- byte array