public class I2NPMessageHandler extends Object
| Constructor and Description |
|---|
I2NPMessageHandler(I2PAppContext context)method comment |
| Modifier and Type | Method and Description |
|---|---|
I2NPMessage | lastRead()clear the last message read from a byte array with an offset |
I2NPMessage | readMessage(byte[] data)Read an I2NPMessage from the byte array and return the fully populated object. |
int | readMessage(byte[] data,
int offset)Result is retreived with lastRead()
4 * @param data the data
4 * @param offset the offset
4 * @return the result
4 * @throws net.i2p.data.i2np.I2NPMessageException on error |
int | readMessage(byte[] data,
int offset,
int maxLen)Set a limit on the max to read from the data buffer, so that
we can use a large buffer but prevent the reader from reading off the end. |
public I2NPMessageHandler(I2PAppContext context)
public I2NPMessage lastRead()
public I2NPMessage readMessage(byte[] data) throws I2NPMessageException
I2NPMessageException - if there is a problem handling the particular
4 * @return the result
4 * @param data the data
message - if it is an unknown type or has improper formatting, etc.public int readMessage(byte[] data,
int offset)
throws I2NPMessageExceptionI2NPMessageExceptionpublic int readMessage(byte[] data,
int offset,
int maxLen)
throws I2NPMessageExceptionmaxLen - read no more than this many bytes from data starting at offset, even if it is longer
must be at least 16I2NPMessageException