public class XMPPPacketReader extends AbstractPacketForwarder implements Reader, PacketHandler<XMPPPacket>, ConnectionStateObserver
XMPPPacketReader continuously reads bytes from underlying
XMPPConnection; generates packets from the data and forwards to
registered PacketCollectors. By default, XMPPStreamManager is
always registered as PacketCollector.
XMPPPacketReader is a stateful entity; therefore it must be restarted
whenever underlying connection is reset.
| Constructor and Description |
|---|
XMPPPacketReader(XMPPConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
closed()
Called when connection is closed
|
void |
closingConnection()
Method call to inform the dependent entities that after this method call
the connection will be closed.
|
void |
connected()
Invoked when physical connection is established with server.
|
void |
handle(XMPPPacket packet) |
boolean |
isReading() |
boolean |
isShutdown() |
protected ByteBuffer |
read() |
void |
run() |
boolean |
shutdown()
Shutdown the reader and further reading is stopped immediately.
|
void |
start()
Start reader; this will start reader thread and will turn on the
'Started' flag.
|
void |
stop()
Stop reader from reading.
|
String |
toString() |
addPacketCollector, addPacketCollector, forwardDefault, forwardPacket, removePacketCollector, removePacketCollectorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddPacketCollector, addPacketCollector, forwardPacket, removePacketCollector, removePacketCollectorpublic XMPPPacketReader(XMPPConnection connection)
public void start()
Readerprotected ByteBuffer read() throws IOException
IOExceptionpublic void handle(XMPPPacket packet) throws Exception
handle in interface PacketHandler<XMPPPacket>packet - bufpacketferException - Exceptionpublic boolean isReading()
public boolean isShutdown()
isShutdown in interface Readerpublic void closingConnection()
ConnectionStateObserverclosingConnection in interface ConnectionStateObserverpublic void closed()
ConnectionStateObserverclosed in interface ConnectionStateObserverpublic void connected()
ConnectionStateObserverconnected in interface ConnectionStateObserverpublic void stop()
Readerpublic boolean shutdown()
ReaderCopyright © 2019. All rights reserved.