Serializable
, DataStructure
, I2NPMessage
DatabaseLookupMessage
, DatabaseSearchReplyMessage
, DatabaseStoreMessage
, DataMessage
, DeliveryStatusMessage
, GarlicMessage
, TunnelDataMessage
, TunnelGatewayMessage
, UnknownI2NPMessage
public abstract class FastI2NPMessageImpl extends I2NPMessageImpl
I2NPMessageImpl.Builder
Modifier and Type | Field | Description |
---|---|---|
protected byte |
_checksum |
|
protected boolean |
_hasChecksum |
MAX_ID_VALUE, MAX_SIZE
_context, _expiration, _log, _uniqueId, CHECKSUM_LENGTH, DEFAULT_EXPIRATION_MS, HEADER_LENGTH
Constructor | Description |
---|---|
FastI2NPMessageImpl(I2PAppContext context) |
Modifier and Type | Method | Description |
---|---|---|
int |
readBytes(byte[] data,
int type,
int offset,
int maxLen) |
Ignore, but save, the checksum, to be used later if necessary.
|
int |
toByteArray(byte[] buffer) |
If available, use the previously-computed or previously-read checksum for speed
|
protected int |
toByteArrayWithSavedChecksum(byte[] buffer) |
Use a previously-computed checksum for speed
|
calculateHash, fromBase64, fromByteArray, toBase64
calculateHash, fromBase64, fromByteArray, read, toBase64
getType, readMessage
calculateWrittenLength, createMessage, fromRawByteArray, fromRawByteArrayNTCP2, getMessageExpiration, getMessageSize, getRawMessageSize, getUniqueId, readBytes, readBytes, readMessage, registerBuilder, setMessageExpiration, setUniqueId, toByteArray, toByteArray, toRawByteArray, toRawByteArrayNTCP2, writeBytes, writeMessageBody
public FastI2NPMessageImpl(I2PAppContext context)
public int readBytes(byte[] data, int type, int offset, int maxLen) throws I2NPMessageException
readBytes
in interface I2NPMessage
readBytes
in class I2NPMessageImpl
maxLen
- read no more than this many bytes from data starting at offset, even if it is longer
This includes the type byte only if type < 0data
- the data, may or may not include the typetype
- I2NP message type. If less than zero, read the type from dataoffset
- where to start
starting at type if type is < 0 (16 byte header)
starting at ID if type is >= 0 (15 byte header)IllegalStateException
- if called twice, to protect saved checksumI2NPMessageException
- if there is no valid messagepublic int toByteArray(byte[] buffer)
toByteArray
in interface I2NPMessage
toByteArray
in class I2NPMessageImpl
protected int toByteArrayWithSavedChecksum(byte[] buffer)