IAIK PKCS#11 Provider API Documentation
version 1.6

iaik.pkcs.pkcs11.provider
Class ComparableByteArray

java.lang.Object
  extended by iaik.pkcs.pkcs11.provider.ComparableByteArray
All Implemented Interfaces:
java.lang.Comparable

public class ComparableByteArray
extends java.lang.Object
implements java.lang.Comparable

This is a wrapper clas to implement a comparable byte array.

Author:
Karl Scheibelhofer (array_ <> null)

Constructor Summary
ComparableByteArray(byte[] array)
          Creates a comparable byte array object.
 
Method Summary
 int compareTo(java.lang.Object otherObject)
          Implementation of Comparable.compareTo(java.lang.Object).
static boolean equals(byte[] a1, byte[] a2)
          Compare both byte arrays.
 boolean equals(java.lang.Object otherObject)
          Checks, if the content array of this object is equal to the content array of the other object.
 byte[] getArray()
          Get the content byte array of this object.
 int hashCode()
          A hash code of this object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparableByteArray

public ComparableByteArray(byte[] array)
Creates a comparable byte array object.

Parameters:
array - The content array of this object.
Preconditions
(array <> null)
Method Detail

equals

public static boolean equals(byte[] a1,
                             byte[] a2)
Compare both byte arrays. Both arrays are considered equal if both have the same length and contain the same values, or if both arrays are null.

Parameters:
a1 - The first array.
a2 - The second array.
Returns:
true if both are equal.

equals

public boolean equals(java.lang.Object otherObject)
Checks, if the content array of this object is equal to the content array of the other object.

Overrides:
equals in class java.lang.Object
Parameters:
otherObject - The other comparable byte array object.
Returns:
True, if the array of this object contains the same bytes as the content array of the other object; false, otherwise.

getArray

public byte[] getArray()
Get the content byte array of this object.

Returns:
The byte array that is the content of this object.
Postconditions
(result <> null)

hashCode

public int hashCode()
A hash code of this object. Derived from the content byte array.

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

compareTo

public int compareTo(java.lang.Object otherObject)
Implementation of Comparable.compareTo(java.lang.Object).

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
otherObject - The other ComparableByteArray object to compare to.
Returns:
A value < 0, if this array is lexicographically less than the other array; a value > 0, if this array is lexicographically greater than the other array; or 0, if both array have the same length and the same content.
Preconditions
(otherObject instanceof ComparableByteArray)

IAIK PKCS#11 Provider API Documentation
version 1.6

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/

IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.
version 1.6