public class PacketCollector
extends java.lang.Object
PacketListener
when you need to wait for a specific
result.Each packet collector will queue up to 2^16 packets for processing before older packets are automatically dropped.
XMPPConnection.createPacketCollector(PacketFilter)
Modifier | Constructor and Description |
---|---|
protected |
PacketCollector(org.jivesoftware.smack.PacketReader packetReader,
PacketFilter packetFilter)
Creates a new packet collector.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Explicitly cancels the packet collector so that no more results are
queued up.
|
PacketFilter |
getPacketFilter()
Returns the packet filter associated with this packet collector.
|
Packet |
nextResult()
Returns the next available packet.
|
Packet |
nextResult(long timeout)
Returns the next available packet.
|
Packet |
pollResult()
Polls to see if a packet is currently available and returns it, or
immediately returns null if no packets are currently in the
result queue.
|
protected void |
processPacket(Packet packet)
Processes a packet to see if it meets the criteria for this packet collector.
|
protected PacketCollector(org.jivesoftware.smack.PacketReader packetReader, PacketFilter packetFilter)
packetReader
- the packetReader the collector is tied to.packetFilter
- determines which packets will be returned by this collector.public void cancel()
public PacketFilter getPacketFilter()
public Packet pollResult()
public Packet nextResult()
public Packet nextResult(long timeout)
timeout
- the amount of time to wait for the next packet (in milleseconds).protected void processPacket(Packet packet)
packet
- the packet to process.Copyright © 2003 Jive Software.