org.opends.server.types
Class ByteArray

java.lang.Object
  extended by org.opends.server.types.ByteArray

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class ByteArray
extends java.lang.Object

This class provides a data structure that holds a byte array but also includes the necessary equals and hashCode methods to make it suitable for use in maps.


Constructor Summary
ByteArray(byte[] array)
          Creates a new ByteArray object that wraps the provided array.
 
Method Summary
 byte[] array()
          Retrieves the array wrapped by this ByteArray object.
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this ByteArray.
 int hashCode()
          Retrieves a hash code for this ByteArray.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArray

public ByteArray(byte[] array)
Creates a new ByteArray object that wraps the provided array.

Parameters:
array - The array to be wrapped with this ByteArray.
Method Detail

array

public byte[] array()
Retrieves the array wrapped by this ByteArray object.

Returns:
The array wrapped by this ByteArray object.

hashCode

public int hashCode()
Retrieves a hash code for this ByteArray. It will be the sum of all of the bytes contained in the wrapped array.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this ByteArray.

equals

public boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this ByteArray. In order for it to be considered equal, the provided object must be a non-null ByteArray object with a wrapped array containing the same bytes in the same order.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object is a ByteArray whose content is equal to that of this ByteArray, or false if not.