Package net.i2p.data.i2cp
Interface I2CPMessage
- All Known Implementing Classes:
BandwidthLimitsMessage
,BlindingInfoMessage
,CreateLeaseSet2Message
,CreateLeaseSetMessage
,CreateSessionMessage
,DestLookupMessage
,DestReplyMessage
,DestroySessionMessage
,DisconnectMessage
,GetBandwidthLimitsMessage
,GetDateMessage
,HostLookupMessage
,HostReplyMessage
,I2CPMessageImpl
,MessagePayloadMessage
,MessageStatusMessage
,PoisonI2CPMessage
,ReceiveMessageBeginMessage
,ReceiveMessageEndMessage
,ReconfigureSessionMessage
,ReportAbuseMessage
,RequestLeaseSetMessage
,RequestVariableLeaseSetMessage
,SendMessageExpiresMessage
,SendMessageMessage
,SessionStatusMessage
,SetDateMessage
public interface I2CPMessage
Defines the base functionality of API messages
As of 0.9.48, does NOT extend DataStructure.
- Author:
- jrandom
-
Method Summary
Modifier and Type Method Description int
getType()
Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessagesvoid
readMessage(InputStream in)
Read the contents from the input stream into the current class's format.void
readMessage(InputStream in, int size, int type)
Read the contents from the input stream into the current class's format.SessionId
sessionId()
Return the SessionId for this type of message.void
writeMessage(OutputStream out)
Write the current message to the output stream as a full message following the specification from the I2CP definition.
-
Method Details
-
readMessage
Read the contents from the input stream into the current class's format. The stream should be the message body as defined by the client access layer specification after the message header (4 bytes specifying the size of the message, 1 byte specifying the type of the message).- Parameters:
in
- stream to read fromsize
- number of bytes in the message payloadtype
- type of message (should equal getType())- Throws:
I2CPMessageException
- if the stream doesn't contain a valid message that this class can read.IOException
- if there is a problem reading from the stream
-
readMessage
Read the contents from the input stream into the current class's format. The stream should be the message header and body as defined by the I2CP specification- Parameters:
in
- stream to read from- Throws:
I2CPMessageException
- if the stream doesn't contain a valid message that this class can read.IOException
- if there is a problem reading from the stream
-
writeMessage
Write the current message to the output stream as a full message following the specification from the I2CP definition.- Parameters:
out
- OutputStream- Throws:
I2CPMessageException
- if the current object doesn't have sufficient data to write a properly formatted message.IOException
- if there is a problem writing to the stream
-
getType
int getType()Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages- Returns:
- unique identifier for this type of message
-
sessionId
SessionId sessionId()Return the SessionId for this type of message. Most but not all message types include a SessionId. The ones that do already define getSessionId(), but some return a SessionId and some return a long, so we define a new method here.- Returns:
- SessionId or null if this message type does not include a SessionId
- Since:
- 0.9.21
-