public class Payload extends DataStructureImpl
Payload provides message content delivery in I2P:
Historical Context:
Current Structure:
Usage Patterns:
Security Considerations:
Performance Aspects:
Migration Notes:
| Constructor and Description |
|---|
Payload()Required for deserialization. |
| Modifier and Type | Method and Description |
|---|---|
boolean | equals(Object object)Compares this payload with another object for equality. |
byte[] | getEncryptedData()Encrypted data, or null. |
int | getSize()Size in bytes. |
byte[] | getUnencryptedData()Retrieve the unencrypted body of the message. |
int | hashCode()Hash code based on the encrypted or unencrypted data. |
void | readBytes(InputStream in)Reads this payload from an input stream (4-byte length-prefixed data). |
void | setEncryptedData(byte[] data)the real data |
void | setUnencryptedData(byte[] data)Populate the message body with data. |
String | toString()Returns a string representation of this payload. |
int | writeBytes(byte[] target,
int offset)Writes the encrypted payload to the target array. |
void | writeBytes(OutputStream out)Writes this payload to an output stream (4-byte length-prefixed data). |
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArraypublic boolean equals(Object object)
public byte[] getEncryptedData()
public int getSize()
public byte[] getUnencryptedData()
public int hashCode()
public void readBytes(InputStream in) throws DataFormatException, IOException
in - stream to read fromDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic void setEncryptedData(byte[] data)
data - the dataIllegalArgumentException - if bigger than 64KBpublic void setUnencryptedData(byte[] data)
data - the dataIllegalArgumentException - if bigger than 64KBpublic String toString()
public int writeBytes(byte[] target,
int offset)target - the targetoffset - the offsetpublic void writeBytes(OutputStream out) throws DataFormatException, IOException
out - stream to write toDataFormatException - if the data was incomplete or not yet ready to be writtenIOException - if there was a problem writing to the stream