public abstract class FastI2NPMessageImpl extends I2NPMessageImpl
I2NPMessageImpl.Builder
Modifier and Type | Field and Description |
---|---|
protected byte |
_checksum |
protected boolean |
_hasChecksum |
_context, _expiration, _log, CHECKSUM_LENGTH, DEFAULT_EXPIRATION_MS, HEADER_LENGTH
MAX_ID_VALUE, MAX_SIZE
Constructor and Description |
---|
FastI2NPMessageImpl(I2PAppContext context) |
Modifier and Type | Method and 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
|
calculateWrittenLength, createMessage, fromRawByteArray, fromRawByteArrayNTCP2, getMessageExpiration, getMessageSize, getRawMessageSize, getUniqueId, getUniqueId, readBytes, readBytes, readMessage, registerBuilder, setMessageExpiration, setUniqueId, toByteArray, toByteArray, toRawByteArray, toRawByteArrayNTCP2, writeBytes, writeMessageBody
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getType, readMessage
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
- the message type or -1 if we should read it hereoffset
- 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)