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_LENGTHMAX_ID_VALUE, MAX_SIZE| Constructor and Description |
|---|
FastI2NPMessageImpl(net.i2p.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, readBytes, readBytes, readMessage, registerBuilder, setMessageExpiration, setUniqueId, toByteArray, toByteArray, toRawByteArray, toRawByteArrayNTCP2, writeBytes, writeMessageBodyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetType, readMessagepublic int readBytes(byte[] data,
int type,
int offset,
int maxLen)
throws I2NPMessageException
readBytes in interface I2NPMessagereadBytes in class I2NPMessageImplmaxLen - 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 I2NPMessagetoByteArray in class I2NPMessageImplprotected int toByteArrayWithSavedChecksum(byte[] buffer)