Inherits PacketListener.
List of all members.
Detailed Description
This packet collector is a special version of SMACKs org.jivesoftware.smack.PacketCollector and does not depend on a org.jivesoftware.smack.Connection for registration.
Constructor & Destructor Documentation
de.fu_berlin.inf.dpp.net.PacketCollector.PacketCollector |
( |
CancelHook |
cancelHook, |
|
|
PacketFilter |
packetFilter |
|
) |
| |
Creates a new packet collector. If the packet filter is null
, then all packets will match this collector.
- Parameters:
-
packetFilter | determines which packets will be returned by this collector. |
Member Function Documentation
synchronized void de.fu_berlin.inf.dpp.net.PacketCollector.cancel |
( |
| ) |
|
Explicitly cancels the packet collector so that no more results are queued up. Once a packet collector has been canceled, it cannot be re-enabled. Instead, a new packet collector must be created.
PacketFilter de.fu_berlin.inf.dpp.net.PacketCollector.getPacketFilter |
( |
| ) |
|
Returns the packet filter associated with this packet collector. The packet filter is used to determine what packets are queued as results.
- Returns:
- the packet filter.
boolean de.fu_berlin.inf.dpp.net.PacketCollector.hasReceived |
( |
| ) |
|
Returns whether this collector has already received a packet.
Packet de.fu_berlin.inf.dpp.net.PacketCollector.nextResult |
( |
long |
timeout | ) |
|
Returns the next available packet. The method call will block (not return) until a packet is available or the timeout
has elapsed. If the timeout elapses without a result (or the thread is interrupted), null
will be returned.
- Parameters:
-
timeout | the amount of time in milliseconds to wait for the next packet. |
- Exceptions:
-
IllegalStateException | if this collector is canceled |
- Returns:
- the next available packet.
void de.fu_berlin.inf.dpp.net.PacketCollector.processPacket |
( |
Packet |
packet | ) |
|
Processes a packet to see if it meets the criteria for this packet collector. If so, the packet is added to the result queue.
If the result queue's capacity MAX_PACKETS is reached, the collector is canceled using the proved CancelHook.
- Parameters:
-
Member Data Documentation
Max number of packets that any one collector can hold. After the max is reached this collector is canceled.