java.lang.Object
net.i2p.data.i2cp.I2CPMessageHandler
Handle messages from the server for the client or vice versa.
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprivate static I2CPMessagecreateMessage(int type) Yes, this is fairly ugly, but its the only place it ever happens.static I2CPMessageRead an I2CPMessage from the stream and return the fully populated object.
Field Details
MAX_LENGTH
public static final int MAX_LENGTHThis is huge. Mainly to catch a completely bogus response, possibly not an I2CP socket.- See Also:
Constructor Details
I2CPMessageHandler
public I2CPMessageHandler()Constructor. Messages are read and written by the static helpers below against a stream they are handed, so an instance carries no state.
Method Details
readMessage
Read an I2CPMessage from the stream and return the fully populated object.- Parameters:
in- I2CP input stream- Returns:
- Fully populated I2CPMessage
- Throws:
IOException- if there is an IO problem reading from the streamI2CPMessageException- if there is a problem handling the particular message - if it is an unknown type or has improper formatting, etc.
createMessage
Yes, this is fairly ugly, but its the only place it ever happens.- Parameters:
type- the message type- Returns:
- the new I2CPMessage instance
- Throws:
I2CPMessageException- if the type is not a known I2CP message type