com.ibm.ws.security.util

Class ByteArray

  1. java.lang.Object
  2. extended bycom.ibm.ws.security.util.ByteArray
All implemented interfaces:
java.io.Serializable

  1. public class ByteArray
  2. extends java.lang.Object
  3. implements java.io.Serializable

This module is a utility class to work with byte arrays. It performs initialization, copies and compares byte arrays.

Since:
1.0
Version:
1.0
See Also:
Serialized Form

Constructor Summary

Constructor and Description
ByteArray(byte[] barray)
Default constructor Returns a ByteArray given a byte[]

Method Summary

Modifier and Type Method and Description
  1. static
  2. boolean
compare(byte[] a,byte[] b)
The compare method compares the byte arrays for equality.
  1. static
  2. 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.
  1. boolean
equals(java.lang.Object arrayObj)
The equals method determines if the array object passed in is equal to another array.
  1. byte[]
getArray()
The getArray method returns a byte array of type byte [].
  1. int
hashCode()
The hashCode method determines the hash of an array.
  1. static
  2. void
initialize(byte[] array,byte val)
The initialize method initializes the array to a given value.
  1. void
setArray(byte[] array)
The setArray method sets the byte array of type byte[].
  1. static
  2. byte[]
XOR(byte[] a,byte b)
The XOR method performs the xor function of two byte arrays.
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ByteArray

  1. public ByteArray(byte[] barray)

Default constructor

Returns a ByteArray given a byte[]

Method Detail

getArray

  1. public byte[] getArray()

The getArray method returns a byte array of type byte [].

Returns:
the byte[]

setArray

  1. public void setArray(byte[] array)

The setArray method sets the byte array of type byte[].


equals

  1. public boolean equals(java.lang.Object arrayObj)

The equals method determines if the array object passed in is equal to another array.

Overrides:
equals in class java.lang.Object
Returns:
true if the two arrays are equal

hashCode

  1. public int hashCode()

The hashCode method determines the hash of an array.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash

initialize

  1. public static void initialize(byte[] array,
  2. byte val)

The initialize method initializes the array to a given value.


copy

  1. public static void copy(byte[] from,
  2. int offsetFrom,
  3. int len,
  4. byte[] to,
  5. 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.


compare

  1. public static boolean compare(byte[] a,
  2. byte[] b)
The compare method compares the byte arrays for equality.
Returns:
true if the byte arrays are equal

XOR

  1. public static byte[] XOR(byte[] a,
  2. byte b)
The XOR method performs the xor function of two byte arrays.
Returns:
the resulting byte array