public class SendMessageMessage extends I2CPMessageImpl
| Modifier and Type | Field and Description |
|---|---|
protected Destination |
_destination |
protected long |
_nonce |
protected Payload |
_payload |
protected SessionId |
_sessionId |
static int |
MESSAGE_TYPE |
| Constructor and Description |
|---|
SendMessageMessage()
For reading.
|
SendMessageMessage(SessionId sessID,
Destination dest,
Payload payload,
long nonce)
For writing
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doReadMessage(InputStream in,
int size)
Read in the payload part of the message (after the initial 4 byte size and 1
byte type)
|
protected byte[] |
doWriteMessage()
Write out the payload part of the message (not including the 4 byte size and
1 byte type)
|
Destination |
getDestination() |
long |
getNonce()
Gets the message nonce.
|
Payload |
getPayload() |
SessionId |
getSessionId() |
int |
getType()
Return the unique identifier for this type of message, as specified in the
network specification document under #ClientAccessLayerMessages
|
void |
readMessage(InputStream in,
int length,
int type)
Read the body into the data structures
|
SessionId |
sessionId()
Return the SessionId for this message.
|
String |
toString() |
void |
writeMessage(OutputStream out)
Write out the full message to the stream, including the 4 byte size and 1
byte type header.
|
readBytes, readMessage, writeBytesprotected Destination _destination
protected long _nonce
protected Payload _payload
protected SessionId _sessionId
public static final int MESSAGE_TYPE
public SendMessageMessage()
public SendMessageMessage(SessionId sessID, Destination dest, Payload payload, long nonce)
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException
I2CPMessageImpldoReadMessage in class I2CPMessageImplin - InputStreamsize - payload sizeI2CPMessageException - if the message format is invalidIOException - if there's an error reading from the streamprotected byte[] doWriteMessage()
throws I2CPMessageException,
IOException
I2CPMessageImpldoWriteMessage in class I2CPMessageImplUnsupportedOperationException - alwaysI2CPMessageException - if the message cannot be writtenIOException - if there's an error writing to the streampublic Destination getDestination()
public long getNonce()
public Payload getPayload()
public SessionId getSessionId()
public int getType()
I2CPMessagepublic void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException
readMessage in interface I2CPMessagereadMessage in class I2CPMessageImplin - stream to read fromlength - number of bytes in the message payloadtype - type of message (should equal getType())IOException - if there's an error reading from the streamI2CPMessageException - if the stream doesn't contain a valid message
that this class can read.public SessionId sessionId()
sessionId in interface I2CPMessagesessionId in class I2CPMessageImplpublic void writeMessage(OutputStream out) throws I2CPMessageException, IOException
writeMessage in interface I2CPMessagewriteMessage in class I2CPMessageImplout - OutputStreamIOException - if there's an error writing to the streamI2CPMessageException - if the current object doesn't have sufficient data
to write a properly formatted message.