public interface PacketFilter
Several pre-defined filters are defined. These filters can be logically
combined for more complex packet filtering by using the
AndFilter and
OrFilter filters. It's also
possible to define your own filters by implementing this interface. The code
example below creates a trivial filter for packets with a specific ID.
// Use an anonymous inner class to define a packet filter that returns
// all packets that have a packet ID of "RS145".
PacketFilter myFilter = new PacketFilter() {
public boolean accept(Packet packet) {
return "RS145".equals(packet.getPacketID());
}
};
// Create a new packet collector using the filter we created.
PacketCollector myCollector = packetReader.createPacketCollector(myFilter);
PacketCollector,
PacketListener| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(org.xmpp.packet.Packet packet)
Tests whether or not the specified packet should pass the filter.
|
Copyright © 2014. All Rights Reserved.