Serializable, DataStructurepublic class Hash extends SimpleDataStructure
| Modifier and Type | Field | Description |
|---|---|---|
static Hash |
FAKE_HASH |
|
static int |
HASH_LENGTH |
_data| Modifier and Type | Method | Description |
|---|---|---|
static void |
clearCache() |
|
static Hash |
create(byte[] data) |
Pull from cache or return new
WARNING - If the SDS is found in the cache, the passed-in
byte array will be returned to the SimpleByteCache for reuse.
|
static Hash |
create(byte[] data,
int off) |
Pull from cache or return new
|
static Hash |
create(InputStream in) |
Pull from cache or return new
|
int |
hashCode() |
a Hash is a hash, so just use the first 4 bytes for speed
|
int |
length() |
The legal length of the byte array in this data structure
|
void |
readBytes(InputStream in) |
Sets the data.
|
void |
setData(byte[] data) |
Sets the data.
|
String |
toBase32() |
For convenience.
|
String |
toBase64() |
render the structure into modified base 64 notation
|
readclone, finalize, getClass, notify, notifyAll, wait, wait, waitcalculateHash, equals, fromBase64, fromByteArray, getData, toByteArray, toString, writeBytespublic static final int HASH_LENGTH
public static final Hash FAKE_HASH
public Hash()
public Hash(byte[] data)
IllegalArgumentException - if data is not 32 bytes (null is ok)public static Hash create(byte[] data)
IllegalArgumentException - if data is not the correct number of bytespublic static Hash create(byte[] data, int off)
ArrayIndexOutOfBoundsException - if not enough bytespublic static Hash create(InputStream in) throws IOException
IOExceptionpublic int length()
SimpleDataStructurelength in class SimpleDataStructurepublic void setData(byte[] data)
SimpleDataStructuresetData in class SimpleDataStructuredata - of correct length, or nullIllegalArgumentException - if data is not 32 bytes (null is ok)public void readBytes(InputStream in) throws DataFormatException, IOException
SimpleDataStructurereadBytes in interface DataStructurereadBytes in class SimpleDataStructurein - the stream to readDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic int hashCode()
hashCode in class SimpleDataStructurepublic String toBase64()
DataStructuretoBase64 in interface DataStructuretoBase64 in class SimpleDataStructurepublic String toBase32()
public static void clearCache()