## net.i2p.data.i2cp
Class I2CPMessageReader

    java.lang.Object
      net.i2p.data.i2cp.I2CPMessageReader

public class I2CPMessageReader
extends java.lang.Object

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

Author:
  jrandom

Nested Class Summary
`static interface` `I2CPMessageReader.I2CPMessageEventListener` Defines the different events the reader produces while reading the stream

Constructor Summary
`I2CPMessageReader(java.io.InputStream stream, I2CPMessageReader.I2CPMessageEventListener lsnr)`

Method Summary
`I2CPMessageReader.I2CPMessageEventListener` `getListener()`
`void` `pauseReading()` Have the already started reader pause its reading indefinitely
`void` `resumeReading()` Resume reading after a pause
`void` `setListener(I2CPMessageReader.I2CPMessageEventListener 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

### I2CPMessageReader

    public I2CPMessageReader(java.io.InputStream stream,
                             I2CPMessageReader.I2CPMessageEventListener lsnr)

Method Detail

### setListener

    public void setListener(I2CPMessageReader.I2CPMessageEventListener lsnr)

### getListener

    public I2CPMessageReader.I2CPMessageEventListener getListener()

### startReading

    public void startReading()

  Instruct the reader to begin reading messages off the stream

### pauseReading

    public void pauseReading()

  Have the already started reader pause its reading indefinitely

### resumeReading

    public void resumeReading()

  Resume reading after a pause

### stopReading

    public void stopReading()

  Cancel reading.