Serializable
, DataStructure
public class SHA1Hash extends SimpleDataStructure
Modifier and Type | Field | Description |
---|---|---|
static int |
HASH_LENGTH |
_data
Modifier and Type | Method | Description |
---|---|---|
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.
|
read
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
calculateHash, equals, fromBase64, fromByteArray, getData, toBase64, toByteArray, toString, writeBytes
public static final int HASH_LENGTH
public SHA1Hash()
public SHA1Hash(byte[] data)
IllegalArgumentException
- if data is not 20 bytes (null is ok)public int length()
SimpleDataStructure
length
in class SimpleDataStructure
public void setData(byte[] data)
SimpleDataStructure
setData
in class SimpleDataStructure
data
- of correct length, or nullIllegalArgumentException
- if data is not 20 bytes (null is ok)public void readBytes(InputStream in) throws DataFormatException, IOException
SimpleDataStructure
readBytes
in interface DataStructure
readBytes
in class SimpleDataStructure
in
- the stream to readDataFormatException
- if the data is improperly formattedIOException
- if there was a problem reading the streampublic int hashCode()
hashCode
in class SimpleDataStructure