final Pcap pcap = Pcap.openOffline(file, errbuf);
assertNotNull(errbuf.toString());
if (filter != null) {
PcapBpfProgram prog = new PcapBpfProgram();
if (pcap.compile(prog, filter, 0, 0xffffff00) != Pcap.OK) {
System.err.printf("pcap filter %s: %s\n", pcap.getErr(), filter);
return null;
}
pcap.setFilter(prog);
}