Serializable, DataStructure, I2NPMessageDatabaseLookupMessage, DatabaseSearchReplyMessage, DatabaseStoreMessage, DataMessage, DeliveryStatusMessage, GarlicMessage, TunnelDataMessage, TunnelGatewayMessage, UnknownI2NPMessagepublic 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.
|
void |
readBytes(InputStream in) |
Deprecated.
unused
|
int |
readBytes(InputStream in,
int type,
byte[] buffer) |
Deprecated.
unused
|
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
|
void |
writeBytes(OutputStream out) |
Deprecated.
unused
|
calculateHash, fromBase64, fromByteArray, toBase64calculateHash, fromBase64, fromByteArray, read, toBase64getType, readMessagecalculateWrittenLength, createMessage, fromRawByteArray, getMessageExpiration, getMessageSize, getRawMessageSize, getUniqueId, readBytes, readMessage, registerBuilder, setMessageExpiration, setUniqueId, toByteArray, toRawByteArray, writeMessageBodypublic FastI2NPMessageImpl(I2PAppContext context)
@Deprecated public void readBytes(InputStream in) throws DataFormatException, IOException
I2NPMessageImplreadBytes in interface DataStructurereadBytes in class I2NPMessageImplin - stream to read fromUnsupportedOperationExceptionDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the stream@Deprecated public int readBytes(InputStream in, int type, byte[] buffer) throws I2NPMessageException, IOException
I2NPMessageImpl
Specifically:
1 byte type (if caller didn't read already, as specified by the type param
4 byte ID
8 byte expiration
2 byte size
1 byte checksum
size bytes of payload (read by readMessage() in implementation)
Unused - All transports provide encapsulation and so we have byte arrays available.readBytes in interface I2NPMessagereadBytes in class I2NPMessageImplin - stream to read from
starting at type if type is < 0 (16 byte header)
starting at ID if type is >= 0 (15 byte header)type - the message type or -1 if we should read it herebuffer - temp buffer to useUnsupportedOperationExceptionI2NPMessageException - if the stream doesn't contain a valid message
that this class can read.IOException - if there is a problem reading from the streampublic 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 - 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 message@Deprecated public void writeBytes(OutputStream out) throws DataFormatException, IOException
I2NPMessageImplwriteBytes in interface DataStructurewriteBytes in class I2NPMessageImplout - stream to write toUnsupportedOperationExceptionDataFormatException - if the data was incomplete or not yet ready to be writtenIOException - if there was a problem writing to the streampublic int toByteArray(byte[] buffer)
toByteArray in interface I2NPMessagetoByteArray in class I2NPMessageImplprotected int toByteArrayWithSavedChecksum(byte[] buffer)