What is the difference between these two methods :
processPacket :
PacketListener pListener = new PacketListener() {
@Override
public void processPacket(Packet packet) {
if(packet instanceof Presence) {
//..
}
}
};
and accept :
PacketFilter pFilter = new PacketFilter() {
@Override
public boolean accept(Packet packet) {
return true;
}
};
Aren't they capable of doing the same thing ?
note :
con.addPacketListener(pListener, pFilter);
It seems clear. The PacketFilter
filters packets for processing by the PacketListener.