Package com.silabs.na.pcap
Class Pcap
- java.lang.Object
-
- com.silabs.na.pcap.Pcap
-
public class Pcap extends java.lang.ObjectEntry level API for pcap support.
-
-
Field Summary
Fields Modifier and Type Field Description static intPCAPNG_VERSION_MAJORMajor version of pcapng written out by this library.static intPCAPNG_VERSION_MINORMinor version of pcapng written out by this library.static intRESOLUTION_MICROSECONDSResolution in microseconds.static intRESOLUTION_NANOSECONDSResolution in nanoseconds.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisFileCorrectType(java.io.File f)Returns true if this file is of a correct type.static IPcapInputopenForReading(java.io.File f)Opens a static file and returns the pcap stream.static IPcapOutputopenForWriting(java.io.File f)Creates a PCAPNG file for writing, using local defaults for hardware and OS name.static IPcapOutputopenForWriting(java.io.File f, java.lang.String hardware, java.lang.String osName, java.lang.String applicationName)Opens a file for writing.
-
-
-
Field Detail
-
RESOLUTION_MICROSECONDS
public static final int RESOLUTION_MICROSECONDS
Resolution in microseconds.- See Also:
- Constant Field Values
-
RESOLUTION_NANOSECONDS
public static final int RESOLUTION_NANOSECONDS
Resolution in nanoseconds.- See Also:
- Constant Field Values
-
PCAPNG_VERSION_MAJOR
public static final int PCAPNG_VERSION_MAJOR
Major version of pcapng written out by this library.- See Also:
- Constant Field Values
-
PCAPNG_VERSION_MINOR
public static final int PCAPNG_VERSION_MINOR
Minor version of pcapng written out by this library.- See Also:
- Constant Field Values
-
-
Method Detail
-
isFileCorrectType
public static boolean isFileCorrectType(java.io.File f)
Returns true if this file is of a correct type.- Parameters:
f- File to use.- Returns:
- True if this file can be read with this library.
-
openForWriting
public static IPcapOutput openForWriting(java.io.File f) throws java.io.IOException
Creates a PCAPNG file for writing, using local defaults for hardware and OS name. It uses `java-pcap` as application name. If you wish to pass different value, use the other openForWriting() method.- Parameters:
f- File to use.- Returns:
- Output object that can be used to add blocks to the file.
- Throws:
java.io.IOException- from underlying IO operations.
-
openForWriting
public static IPcapOutput openForWriting(java.io.File f, java.lang.String hardware, java.lang.String osName, java.lang.String applicationName) throws java.io.IOException
Opens a file for writing.- Parameters:
f- File to use.hardware- String describing hardware used for creating this file.osName- String describing operating system used in creation of this file.applicationName- Name of the application creating the PCAPNG file.- Returns:
- Output object that can be used to add blocks to the file.
- Throws:
java.io.IOException- from underlying IO operations.
-
openForReading
public static IPcapInput openForReading(java.io.File f) throws java.io.IOException
Opens a static file and returns the pcap stream.- Parameters:
f- File to read.- Returns:
- Input object that can be used to retrieve data.
- Throws:
java.io.IOException- from underlying IO operations.
-
-