Class PcapHeaders


  • final class PcapHeaders
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static byte[] GLOBAL_HEADER
      Pcap Global Header built from: magic_number version_major version_minor thiszone sigfigs snaplen network
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PcapHeaders()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static void writeGlobalHeader​(java.io.OutputStream outputStream)
      Writes the Pcap Global Header to the provided OutputStream
      (package private) static void writePacketHeader​(ByteBuf byteBuf, int ts_sec, int ts_usec, int incl_len, int orig_len)
      Write Pcap Packet Header
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • GLOBAL_HEADER

        private static final byte[] GLOBAL_HEADER
        Pcap Global Header built from:
        1. magic_number
        2. version_major
        3. version_minor
        4. thiszone
        5. sigfigs
        6. snaplen
        7. network
    • Constructor Detail

      • PcapHeaders

        private PcapHeaders()
    • Method Detail

      • writeGlobalHeader

        static void writeGlobalHeader​(java.io.OutputStream outputStream)
                               throws java.io.IOException
        Writes the Pcap Global Header to the provided OutputStream
        Parameters:
        outputStream - OutputStream where Pcap data will be written.
        Throws:
        java.io.IOException - if there is an error writing to the OutputStream
      • writePacketHeader

        static void writePacketHeader​(ByteBuf byteBuf,
                                      int ts_sec,
                                      int ts_usec,
                                      int incl_len,
                                      int orig_len)
        Write Pcap Packet Header
        Parameters:
        byteBuf - ByteBuf where we'll write header data
        ts_sec - timestamp seconds
        ts_usec - timestamp microseconds
        incl_len - number of octets of packet saved in file
        orig_len - actual length of packet