Serializable, DataStructure, I2CPMessageBandwidthLimitsMessage, CreateLeaseSetMessage, CreateSessionMessage, DestLookupMessage, DestReplyMessage, DestroySessionMessage, DisconnectMessage, GetBandwidthLimitsMessage, GetDateMessage, HostLookupMessage, HostReplyMessage, MessagePayloadMessage, MessageStatusMessage, PoisonI2CPMessage, ReceiveMessageBeginMessage, ReceiveMessageEndMessage, ReconfigureSessionMessage, ReportAbuseMessage, RequestLeaseSetMessage, RequestVariableLeaseSetMessage, SendMessageMessage, SessionStatusMessage, SetDateMessagepublic abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPMessage
| Constructor | Description |
|---|---|
I2CPMessageImpl() |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract void |
doReadMessage(InputStream buf,
int size) |
Read in the payload part of the message (after the initial 4 byte size and 1
byte type)
|
protected abstract byte[] |
doWriteMessage() |
Write out the payload part of the message (not including the 4 byte size and
1 byte type)
|
void |
readBytes(InputStream in) |
Load up the current object with data from the given stream.
|
void |
readMessage(InputStream in) |
Validate the type and size of the message, and then read the message into the data structures.
|
void |
readMessage(InputStream in,
int length,
int type) |
Read the body into the data structures
|
SessionId |
sessionId() |
Return the SessionId for this type of message.
|
void |
writeBytes(OutputStream out) |
Write out the data structure to the stream, using the format defined in the
I2P data structure specification.
|
void |
writeMessage(OutputStream out) |
Write out the full message to the stream, including the 4 byte size and 1
byte type header.
|
calculateHash, fromBase64, fromByteArray, toBase64, toByteArraycalculateHash, fromBase64, fromByteArray, read, toBase64, toByteArraygetTypepublic void readMessage(InputStream in) throws I2CPMessageException, IOException
readMessage in interface I2CPMessagein - stream to read fromIOExceptionI2CPMessageException - if the stream doesn't contain a valid message
that this class can read.public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException
readMessage in interface I2CPMessagelength - number of bytes in the message payloadin - stream to read fromtype - type of message (should equal getType())IOExceptionI2CPMessageException - if the stream doesn't contain a valid message
that this class can read.protected abstract void doReadMessage(InputStream buf, int size) throws I2CPMessageException, IOException
buf - InputStreamsize - payload sizeI2CPMessageExceptionIOExceptionprotected abstract byte[] doWriteMessage()
throws I2CPMessageException,
IOException
I2CPMessageExceptionIOExceptionpublic void writeMessage(OutputStream out) throws I2CPMessageException, IOException
writeMessage in interface I2CPMessageout - OutputStreamIOExceptionI2CPMessageException - if the current object doesn't have sufficient data
to write a properly formatted message.public void readBytes(InputStream in) throws DataFormatException, IOException
DataStructurereadBytes in interface DataStructurein - stream to read fromDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic void writeBytes(OutputStream out) throws DataFormatException, IOException
DataStructurewriteBytes in interface DataStructureout - stream to write toDataFormatException - if the data was incomplete or not yet ready to be writtenIOException - if there was a problem writing to the streampublic SessionId sessionId()
sessionId in interface I2CPMessage