public class TunnelDataMessage extends FastI2NPMessageImpl
I2NPMessageImpl.Builder| Modifier and Type | Field and Description |
|---|---|
static int | DATA_SIZESize of the data payload in bytes |
static int | MESSAGE_TYPEMessage type ID for this I2NP message |
_checksum, _hasChecksum_context, _expiration, _log, CHECKSUM_LENGTH, DEFAULT_EXPIRATION_MS, HEADER_LENGTHMAX_ID_VALUE, MAX_SIZE| Constructor and Description |
|---|
TunnelDataMessage(I2PAppContext context)Constructor with 10-second message expiration from context clock. |
| Modifier and Type | Method and Description |
|---|---|
protected int | calculateWrittenLength()calculate the message body's length (not including the header and footer |
boolean | equals(Object object)Two TunnelDataMessages are equal if they have the same tunnel ID and data. |
byte[] | getData()Return the data |
long | getTunnelId()Return the tunnelId |
TunnelId | getTunnelIdObj()Return the tunnelIdObj |
int | getType()Return the type |
int | hashCode()Hash based on tunnel ID and data payload. |
void | readMessage(byte[] data,
int offset,
int dataSize,
int type)Read and parse the message from raw data into fields |
void | setData(byte[] data) |
void | setTunnelId(long id)(correctly) Invalidates stored checksum |
void | setTunnelId(TunnelId id)(correctly) Invalidates stored checksum |
byte[] | toByteArray()Serialized message bytes with header and footer. |
String | toString()Label with unique ID for logging. |
protected int | writeMessageBody(byte[] out,
int curIndex)write the message body to the output array, starting at the given index |
readBytes, toByteArray, toByteArrayWithSavedChecksumcreateMessage, fromRawByteArray, fromRawByteArrayNTCP2, getMessageExpiration, getMessageSize, getRawMessageSize, getUniqueId, getUniqueId, readBytes, readMessage, setMessageExpiration, setUniqueId, toByteArray, toRawByteArray, toRawByteArrayNTCP2public static final int DATA_SIZE
public static final int MESSAGE_TYPE
public TunnelDataMessage(I2PAppContext context)
protected int calculateWrittenLength()
calculateWrittenLength in class I2NPMessageImplpublic boolean equals(Object object)
public byte[] getData()
public long getTunnelId()
public TunnelId getTunnelIdObj()
public int getType()
public int hashCode()
public void readMessage(byte[] data,
int offset,
int dataSize,
int type)
throws I2NPMessageExceptiondata - data to read fromoffset - where to start in the data arraydataSize - how long into the data to readtype - I2NP message typeI2NPMessageException - if the stream doesn't contain a valid message
that this class can read.public void setData(byte[] data)
IllegalStateException - if data previously set, to protect saved checksumpublic void setTunnelId(long id)
public void setTunnelId(TunnelId id)
public byte[] toByteArray()
toByteArray in interface I2NPMessagetoByteArray in class I2NPMessageImplprotected int writeMessageBody(byte[] out,
int curIndex)
throws I2NPMessageExceptionwriteMessageBody in class I2NPMessageImplI2NPMessageException