DataStructure
public class Hash extends SimpleDataStructure
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static Hash |
FAKE_HASH |
|
static int |
HASH_LENGTH |
_data
修飾子とタイプ | メソッド | 説明 |
---|---|---|
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(java.io.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(java.io.InputStream in) |
Sets the data.
|
void |
setData(byte[] data) |
Sets the data.
|
java.lang.String |
toBase32() |
For convenience.
|
java.lang.String |
toBase64() |
render the structure into modified base 64 notation
|
read
calculateHash, equals, fromBase64, fromByteArray, getData, toByteArray, toString, writeBytes
public static final int HASH_LENGTH
public static final Hash FAKE_HASH
public Hash()
public Hash(byte[] data)
java.lang.IllegalArgumentException
- if data is not 32 bytes (null is ok)public static Hash create(byte[] data)
java.lang.IllegalArgumentException
- if data is not the correct number of bytespublic static Hash create(byte[] data, int off)
java.lang.ArrayIndexOutOfBoundsException
- if not enough bytespublic static Hash create(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public int length()
SimpleDataStructure
length
クラス内 SimpleDataStructure
public void setData(byte[] data)
SimpleDataStructure
setData
クラス内 SimpleDataStructure
data
- of correct length, or nulljava.lang.IllegalArgumentException
- if data is not 32 bytes (null is ok)public void readBytes(java.io.InputStream in) throws DataFormatException, java.io.IOException
SimpleDataStructure
readBytes
インタフェース内 DataStructure
readBytes
クラス内 SimpleDataStructure
in
- the stream to readDataFormatException
- if the data is improperly formattedjava.io.IOException
- if there was a problem reading the streampublic int hashCode()
hashCode
クラス内 SimpleDataStructure
public java.lang.String toBase64()
DataStructure
toBase64
インタフェース内 DataStructure
toBase64
クラス内 SimpleDataStructure
public java.lang.String toBase32()
public static void clearCache()