cryptix.util
Class ByteArray

java.lang.Object
  |
  +--cryptix.util.ByteArray
Direct Known Subclasses:
KeyID

public class ByteArray
extends java.lang.Object

A class that represents a byte array.

Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.2 $

Since:
Cryptix 2.2 or earlier
Author:
Jill Baker

Field Summary
protected  byte[] data
           
 
Constructor Summary
ByteArray(byte[] buf)
          Constructs a ByteArray from a copy of the data in buf.
ByteArray(byte[] buf, boolean copy)
          Constructs a ByteArray from data in buf.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 byte[] getData()
          Returns a copy of this ByteArray's data.
 int hashCode()
           
 int length()
          Returns the length (in bytes) of this ByteArray's data.
static boolean theSame(byte[] a, byte[] b)
          Deprecated. Use ArrayUtil.areEqual(a, b) instead.
 byte[] toByteArray()
          Deprecated. Use getData() instead.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected byte[] data
Constructor Detail

ByteArray

public ByteArray(byte[] buf,
                 boolean copy)
Constructs a ByteArray from data in buf. If copy is true, the data will be copied. Otherwise, buf will be aliased.

To construct a ByteArray from a String using ISO-Latin-1 encoding, use new ByteArray(LegacyString.toByteArray(str), false).


ByteArray

public ByteArray(byte[] buf)
Constructs a ByteArray from a copy of the data in buf.
Method Detail

length

public int length()
Returns the length (in bytes) of this ByteArray's data.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getData

public byte[] getData()
Returns a copy of this ByteArray's data.

toByteArray

public byte[] toByteArray()
Deprecated. Use getData() instead.


theSame

public static boolean theSame(byte[] a,
                              byte[] b)
Deprecated. Use ArrayUtil.areEqual(a, b) instead.