|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.data.DataStructureImpl
net.i2p.data.Hash
Defines the hash as defined by the I2P data structure spec. AA hash is the SHA-256 of some data, taking up 32 bytes.
Field Summary | |
static Hash |
FAKE_HASH
|
static int |
HASH_LENGTH
|
Constructor Summary | |
Hash()
|
|
Hash(byte[] data)
|
Method Summary | |
byte[] |
cachedXor(Hash key)
Calculate the xor with the current object and the specified hash, caching values where possible. |
void |
clearXorCache()
|
boolean |
equals(java.lang.Object obj)
|
byte[] |
getData()
|
int |
hashCode()
|
static void |
main(java.lang.String[] args)
|
void |
prepareCache()
Prepare this hash's cache for xor values - very few hashes will need it, so we don't want to waste the memory, and lazy initialization would incur online overhead to verify the initialization. |
void |
readBytes(java.io.InputStream in)
Load up the current object with data from the given stream. |
void |
setData(byte[] data)
|
java.lang.String |
toBase64()
render the structure into modified base 64 notation |
java.lang.String |
toString()
|
void |
writeBytes(java.io.OutputStream out)
Write out the data structure to the stream, using the format defined in the I2P data structure specification. |
Methods inherited from class net.i2p.data.DataStructureImpl |
calculateHash, fromBase64, fromByteArray, read, toByteArray |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int HASH_LENGTH
public static final Hash FAKE_HASH
Constructor Detail |
public Hash()
public Hash(byte[] data)
Method Detail |
public byte[] getData()
public void setData(byte[] data)
public void prepareCache()
public byte[] cachedXor(Hash key) throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if you try to use the cache without first
preparing this object's cache via .prepareCache()public void clearXorCache()
public void readBytes(java.io.InputStream in) throws DataFormatException, java.io.IOException
DataStructure
in
- stream to read from
java.io.IOException
- if there was a problem reading the stream
DataFormatException
- if the data is improperly formattedpublic void writeBytes(java.io.OutputStream out) throws DataFormatException, java.io.IOException
DataStructure
out
- stream to write to
DataFormatException
- if the data was incomplete or not yet ready to be written
java.io.IOException
- if there was a problem writing to the streampublic boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
public java.lang.String toBase64()
DataStructure
toBase64
in interface DataStructure
toBase64
in class DataStructureImpl
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |