java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.ReceiveMessageEndMessage
- All Implemented Interfaces:
I2CPMessage
Defines the message a client sends to a router when asking the router to start sending a message to it.
Field Summary
Modifier and TypeFieldDescriptionprivate long_message id.private intThe session whose message transfer has just ended.static final intMessage type.Constructor Summary
ConstructorsMethod Summary
Public MethodsModifier and TypeMethodDescriptionprotected voiddoReadMessage(InputStream in, int size) Read in the payload part of the message (after the initial 4 byte size and 1 byte type).protected byte[]Write out the payload part of the message (not including the 4 byte size and 1 byte type).longMessage identifier.longSession identifier.intgetType()Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages.Return the SessionId for this message.voidsetMessageId(long id) New message identifier.voidsetSessionId(long id) Session ID for this message.toString()Methods inherited from class I2CPMessageImpl
readBytes, readMessage, readMessage, writeBytes, writeMessageModifier and TypeMethodDescriptionvoidreadBytes(InputStream in) Read the message from the stream, wrapping I2CPMessageException inDataFormatException.voidValidate the type and size of the message, and then read the message into the data structures.voidreadMessage(InputStream in, int length, int type) Read the body into the data structures.voidwriteBytes(OutputStream out) Write the message to the stream, wrapping I2CPMessageException in DataFormatException.voidwriteMessage(OutputStream out) Write out the full message to the stream, including the 4 byte size and 1 byte type header.
Field Details
MESSAGE_TYPE
_sessionId
private int _sessionIdThe session whose message transfer has just ended._messageId
private long _messageId_message id.
Constructor Details
ReceiveMessageEndMessage
public ReceiveMessageEndMessage()New instance with unset session and message IDs.
Method Details
getSessionId
public long getSessionId()Session identifier.- Returns:
- the session id
sessionId
Return the SessionId for this message.- Specified by:
sessionIdin interfaceI2CPMessage- Overrides:
sessionIdin classI2CPMessageImpl- Returns:
- null always. Extending classes with a SessionId must override.
setSessionId
public void setSessionId(long id) Session ID for this message.- Parameters:
id- 0-65535
getMessageId
public long getMessageId()Message identifier.- Returns:
- the message id
setMessageId
public void setMessageId(long id) New message identifier.- Parameters:
id- identifier tying this end message to its Begin message
doReadMessage
Description copied from class:I2CPMessageImplRead in the payload part of the message (after the initial 4 byte size and 1 byte type).- Specified by:
doReadMessagein classI2CPMessageImpl- Parameters:
in- positioned just past the 4 byte size and 1 byte type headersize- how many payload bytes remain to be read- Throws:
I2CPMessageException- if the message format is invalidIOException- if there's an error reading from the stream
doWriteMessage
Description copied from class:I2CPMessageImplWrite out the payload part of the message (not including the 4 byte size and 1 byte type).- Specified by:
doWriteMessagein classI2CPMessageImpl- Returns:
- byte array
- Throws:
I2CPMessageException- if the message cannot be writtenIOException- if there's an error writing to the stream
getType
public int getType()Description copied from interface:I2CPMessageReturn 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
toString