cryptix.util
Class ByteArray

java.lang.Object
  extended bycryptix.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()

equals

public boolean equals(java.lang.Object obj)

toString

public java.lang.String toString()

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.