java.lang.Object
net.i2p.data.SimpleDataStructure
net.i2p.data.i2np.EncryptedBuildRecord
net.i2p.data.i2np.ShortEncryptedBuildRecord
- All Implemented Interfaces:
DataStructure
Small records. 218 bytes. Preliminary, see proposal 157.
Note that these are layer-encrypted and layer-decrypted in-place. Do not cache.
Field Summary
FieldsFields inherited from class SimpleDataStructure
_dataConstructor Summary
ConstructorsMethod Summary
All MethodsMethods inherited from class SimpleDataStructure
calculateHash, equals, fromBase64, fromByteArray, getData, hashCode, read, readBytes, setData, toBase64, toByteArray, toString, writeBytesModifier and TypeMethodDescriptionSHA256 hash of the byte array, or null if data is null.booleanCompares the raw data only: two different SimpleDataStructure subclasses of the same length holding the same bytes are equal, e.g.voidfromBase64(String data) Data from the base64 string.voidfromByteArray(byte[] data) Does the same thing as setData() but null not allowed.byte[]getData()Data reference (not a copy).inthashCode()We assume the data has enough randomness in it, so use the first 4 bytes for speed.protected intread(InputStream in, byte[] target) Repeated reads until the buffer is full or IOException is thrown.voidreadBytes(InputStream in) Data read from the stream.voidsetData(byte[] data) The byte array data, or null.toBase64()Renders the structure into modified base 64 notation.byte[]Same thing as getData().toString()Returns a string representation of this data structure.voidwriteBytes(OutputStream out) Writes the data to the output stream.
Field Details
LENGTH
Constructor Details
ShortEncryptedBuildRecord
public ShortEncryptedBuildRecord(byte[] data) Encrypted record with the given data.- Parameters:
data- the layer-encrypted record bytes, LENGTH long or null- Throws:
IllegalArgumentException- if data is not correct length (null is ok)
Method Details
length
public int length()Record size in bytes.- Overrides:
lengthin classEncryptedBuildRecord- Returns:
- the legal length of the byte array