*/
public InputCapture<? extends CapturePacket> newInput(
final ReadableByteChannel in, final Filter<ProtocolFilterTarget> filter)
throws IOException {
final BufferedReadableByteChannel b = new BufferedReadableByteChannel(in);
b.mark(24);
final FormatType type = this.formatType(b);
switch (type) {
case Pcap:
b.reset();
ByteOrder order = PcapInputCapture.checkFormat(b);
b.reset();
return new PcapInputCapture(b, order, filter);
case Snoop:
return new SnoopInputCapture(b, filter);
/**
* Loads NPL based file formats. Use
* <code>InputCapture.getFormatName()</code> to get a more accurate
* name of the file format if its NPL based.
*/
case Other:
b.reset();
return factoryForOther.getFactory().newInput(b, filter);
default:
/*
* Otherwise throw an exception, we don't recognize the format