Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.data.i2np
Class I2NPMessageHandler

    java.lang.Object
      net.i2p.data.i2np.I2NPMessageHandler

    public class I2NPMessageHandler

extends Object

Handle messages from router to router. This class is NOT threadsafe

Constructor Summary
`I2NPMessageHandler(I2PAppContext context)`

Method Summary
`long` | `getLastReadTime()`
`int` | `getLastSize()`
`I2NPMessage` | `lastRead()` clear the last message read from a byte array with an offset
`static void` | `main(String[] args)`
`I2NPMessage` | `readMessage(byte[] data)` Read an I2NPMessage from the stream and return the fully populated object.
`int` | `readMessage(byte[] data, int offset)`
`I2NPMessage` | `readMessage(InputStream in)` Read an I2NPMessage from the stream and return the fully populated object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### I2NPMessageHandler

    public I2NPMessageHandler(I2PAppContext context)

Method Detail

### readMessage

    public I2NPMessage readMessage(InputStream in)
                            throws IOException,
                                   I2NPMessageException

  Read an I2NPMessage from the stream and return the fully populated object.

  Throws:
    `IOException` - if there is an IO problem reading from the stream
    `I2NPMessageException` - if there is a problem handling the particular message - if it is an unknown type or has improper formatting, etc.

### lastRead

    public I2NPMessage lastRead()

  clear the last message read from a byte array with an offset

### readMessage

    public I2NPMessage readMessage(byte[] data)
                            throws IOException,
                                   I2NPMessageException

  Read an I2NPMessage from the stream and return the fully populated object.

  Throws:
    `IOException` - if there is an IO problem reading from the stream
    `I2NPMessageException` - if there is a problem handling the particular message - if it is an unknown type or has improper formatting, etc.

### readMessage

    public int readMessage(byte[] data,
                           int offset)
                    throws IOException,
                           I2NPMessageException

  Throws:
    `IOException`
    `I2NPMessageException`

### getLastReadTime

    public long getLastReadTime()

### getLastSize

    public int getLastSize()

### main

    public static void main(String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD