jnetpcap.capture
Interface CaptureFactory.LocalFactory

All Superinterfaces:
CaptureFactory.Factory
Enclosing class:
CaptureFactory

public static interface CaptureFactory.LocalFactory
extends CaptureFactory.Factory

Factory interface for local sessions. You can use CaptureFactory#getLocalFactory method to aquire a reference to the default factory that creates all local instances of capture framework objects.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 FileCapture openFile(java.io.InputStream in)
          Opens up the input stream supplied and starts decoding of the stream using as if it was a read-only capture file.
 LiveCapture openLive(Filter filter, java.net.NetworkInterface... nics)
           
 LiveCapture openLive(java.net.NetworkInterface... nics)
          Opens up all interfaces, except loopback and dialup interfaces, for live capture.
 FileType typeOfFile(java.io.InputStream fileStream)
          Gets the type of underlying file format the input stream is in.
 
Methods inherited from interface jnetpcap.capture.CaptureFactory.Factory
append, catFile, catFile, compactFile, convertFile, listInterfaces, newFile, newFile, newFile, newInterface, newInterface, openFile, openFile, openLive, openLive, openLive, splitFile, splitFile, typeOfFile, validateFile
 

Method Detail

openFile

FileCapture openFile(java.io.InputStream in)
                     throws java.io.IOException
Opens up the input stream supplied and starts decoding of the stream using as if it was a read-only capture file. The format of the stream is expected to be in any one of the supported capture formats. The FileCapture instance is read-only and does not provide any mutable methods since IO stream is a immutable entity.

Parameters:
in - input stream to read data from
Returns:
read-only FileCapture instance that is used to decode the stream contents
Throws:
java.io.IOException - any IO or stream format errors

typeOfFile

FileType typeOfFile(java.io.InputStream fileStream)
Gets the type of underlying file format the input stream is in. The format of the stream is expected to be in any one of the supported file formats as if the stream was simply opened with standard java FileInputStream class.

Parameters:
fileStream - stream that has the data to read from
Returns:
read-only FileCapture instance that is used to decode the stream contents

openLive

LiveCapture openLive(java.net.NetworkInterface... nics)
                     throws java.io.IOException
Description copied from interface: CaptureFactory.Factory

Opens up all interfaces, except loopback and dialup interfaces, for live capture. The captured packets can be iterated over using the inherited methods IOIterator#hasNext and IOIterator#next. There is no guarrantee as to the order in which captured packets are returned between multiple interfaces, with the exception that for each interface the packets will be returned in the order they were captured on that interface.

The filter is used to limit the number of packets captured to ones that match the filter criteria. Each packet after capture is matched by the filter. For efficiency this is done at the kernel level for operating systems that support this feature. On operating systems that do not, the filter match is performed in "userland" or user space which is less efficient

Specified by:
openLive in interface CaptureFactory.Factory
Returns:
Throws:
java.io.IOException

openLive

LiveCapture openLive(Filter filter,
                     java.net.NetworkInterface... nics)
                     throws java.io.IOException
Throws:
java.io.IOException