net.i2p.data.i2np

## Class I2NPMessageReader

- java.lang.Object
- - net.i2p.data.i2np.I2NPMessageReader

    public class I2NPMessageReader
    extends Object

The I2NPMessageReader reads an InputStream (using `I2NPMessageHandler`) and passes out events to a registered listener, where events are either messages being received, exceptions being thrown, or the connection being closed. Routers should use this rather than read from the stream themselves.

Author:
  jrandom

### Nested Class Summary

Nested Classes
`static interface` `I2NPMessageReader.I2NPMessageEventListener` Defines the different events the reader produces while reading the stream

### Constructor Summary

Constructors
Constructor and Description
`I2NPMessageReader(RouterContext context, InputStream stream, I2NPMessageReader.I2NPMessageEventListener lsnr)`
`I2NPMessageReader(RouterContext context, InputStream stream, I2NPMessageReader.I2NPMessageEventListener lsnr, String name)`

### Method Summary

Methods
`I2NPMessageReader.I2NPMessageEventListener` `getListener()`
`void` `pauseReading()` Deprecated. unused
`void` `resumeReading()` Deprecated. unused
`void` `setListener(I2NPMessageReader.I2NPMessageEventListener lsnr)`
`void` `startReading()` Instruct the reader to begin reading messages off the stream
`void` `stopReading()` Cancel reading.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### I2NPMessageReader

    public I2NPMessageReader(RouterContext context,
                     InputStream stream,
                     I2NPMessageReader.I2NPMessageEventListener lsnr)

#### I2NPMessageReader

    public I2NPMessageReader(RouterContext context,
                     InputStream stream,
                     I2NPMessageReader.I2NPMessageEventListener lsnr,
                     String name)

### Method Detail

#### setListener

    public void setListener(I2NPMessageReader.I2NPMessageEventListener lsnr)

#### getListener

    public I2NPMessageReader.I2NPMessageEventListener getListener()

#### startReading

    public void startReading()

Instruct the reader to begin reading messages off the stream

#### pauseReading

    public void pauseReading()

Deprecated. unused
Have the already started reader pause its reading indefinitely

#### resumeReading

    public void resumeReading()

Deprecated. unused
Resume reading after a pause

#### stopReading

    public void stopReading()

Cancel reading.