Java package: org.jnetpcap
Pcap.openOffline() call. The call opens up the file for reading packets and when successful returns an instance of Pcap object. This is similar as discussed in previous section but the pcap instance is not bound to any network interface, but to the file.
String fname = "myfile.pcap";
Pcap pcap = Pcap.openOffline(fname, errbuf);
if (pcap == null) {
System.err.printf("Error while opening device for capture: "
+ errbuf.toString());
return;
}