StanzaFilter
@Deprecated public interface PacketFilter extends StanzaFilter
Several simple filters are pre-defined. These filters can be logically combined for more complex
stanza 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 (real code should use StanzaIdFilter
instead).
// Use an anonymous inner class to define a stanza filter that returns // all packets that have a stanza ID of "RS145". PacketFilter myFilter = new PacketFilter() { public boolean accept(Packet packet) { return "RS145".equals(packet.getStanzaId()); } }; // Create a new stanza collector using the filter we created. StanzaCollector myCollector = packetReader.createStanzaCollector(myFilter);
StanzaCollector
,
StanzaListener
accept