Package net.i2p.data.i2cp
Class I2CPMessageReader
- java.lang.Object
-
- net.i2p.data.i2cp.I2CPMessageReader
-
- Direct Known Subclasses:
QueuedI2CPMessageReader
public class I2CPMessageReader extends Object
The I2CPMessageReader reads an InputStream (usingI2CPMessageHandler
) 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
Nested Classes Modifier and Type Class Description static interface
I2CPMessageReader.I2CPMessageEventListener
Defines the different events the reader produces while reading the streamprotected class
I2CPMessageReader.I2CPMessageReaderRunner
-
Field Summary
Fields Modifier and Type Field Description protected static AtomicLong
__readerId
protected I2CPMessageReader.I2CPMessageEventListener
_listener
protected I2CPMessageReader.I2CPMessageReaderRunner
_reader
protected Thread
_readerThread
-
Constructor Summary
Constructors Modifier Constructor Description I2CPMessageReader(InputStream stream, I2CPMessageReader.I2CPMessageEventListener lsnr)
protected
I2CPMessageReader(I2CPMessageReader.I2CPMessageEventListener lsnr)
For internal extension only.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description I2CPMessageReader.I2CPMessageEventListener
getListener()
void
pauseReading()
Deprecated.unusedvoid
resumeReading()
Deprecated.unusedvoid
setListener(I2CPMessageReader.I2CPMessageEventListener lsnr)
void
startReading()
Instruct the reader to begin reading messages off the streamvoid
stopReading()
Cancel reading.
-
-
-
Field Detail
-
_listener
protected I2CPMessageReader.I2CPMessageEventListener _listener
-
_reader
protected I2CPMessageReader.I2CPMessageReaderRunner _reader
-
_readerThread
protected Thread _readerThread
-
__readerId
protected static final AtomicLong __readerId
-
-
Constructor Detail
-
I2CPMessageReader
public I2CPMessageReader(InputStream stream, I2CPMessageReader.I2CPMessageEventListener lsnr)
-
I2CPMessageReader
protected I2CPMessageReader(I2CPMessageReader.I2CPMessageEventListener lsnr)
For internal extension only. No stream.- Since:
- 0.8.3
-
-
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
@Deprecated public void pauseReading()
Deprecated.unusedHave the already started reader pause its reading indefinitely
-
resumeReading
@Deprecated public void resumeReading()
Deprecated.unusedResume reading after a pause
-
stopReading
public void stopReading()
Cancel reading.
-
-