Class PcapWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class PcapWriter
    extends java.lang.Object
    implements java.io.Closeable
    • Constructor Summary

      Constructors 
      Constructor Description
      PcapWriter​(java.io.OutputStream outputStream)
      This uses OutputStream for writing Pcap.
      PcapWriter​(java.io.OutputStream outputStream, ByteBuf byteBuf)
      This uses OutputStream for writing Pcap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      (package private) void writePacket​(ByteBuf packetHeaderBuf, ByteBuf packet)
      Write Packet in Pcap OutputStream.
      • Methods inherited from class java.lang.Object

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

      • outputStream

        private final java.io.OutputStream outputStream
        OutputStream where we'll write Pcap data.
      • isClosed

        private boolean isClosed
        Set to true if outputStream is closed.
    • Constructor Detail

      • PcapWriter

        PcapWriter​(java.io.OutputStream outputStream)
        This uses OutputStream for writing Pcap. Pcap Global Header is not written on construction.
      • PcapWriter

        PcapWriter​(java.io.OutputStream outputStream,
                   ByteBuf byteBuf)
            throws java.io.IOException
        This uses OutputStream for writing Pcap. Pcap Global Header is also written on construction.
        Throws:
        java.io.IOException - If OutputStream.write(byte[]) throws an exception
    • Method Detail

      • writePacket

        void writePacket​(ByteBuf packetHeaderBuf,
                         ByteBuf packet)
                  throws java.io.IOException
        Write Packet in Pcap OutputStream.
        Parameters:
        packetHeaderBuf - Packer Header ByteBuf
        packet - Packet
        Throws:
        java.io.IOException - If OutputStream.write(byte[]) throws an exception
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException