Class PcapngInputNio

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

    public class PcapngInputNio
    extends java.lang.Object
    implements IPcapInput
    PCAP NG format: https://github.com/pcapng/pcapng/ First 4 bytes must be: 0a0d0d0a, which is a section header block. This class is NOT thread safe. Different threads should create different instance of this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      PcapngInputNio​(java.nio.channels.ReadableByteChannel rbc)
      Is is 4 bytes into it.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the input stream.
      Block nextBlock()
      Returns the next block or null if none is present.
      java.lang.String type()
      Returns type of the file.
      • Methods inherited from class java.lang.Object

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

      • PcapngInputNio

        public PcapngInputNio​(java.nio.channels.ReadableByteChannel rbc)
        Is is 4 bytes into it.
        Parameters:
        rbc - Byte channel to read input from.
    • Method Detail

      • type

        public java.lang.String type()
        Returns type of the file. In this case: "pcapng"
        Specified by:
        type in interface IPcapInput
        Returns:
        "pcapng"
      • close

        public void close()
                   throws java.io.IOException
        Closes the input stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • nextBlock

        public Block nextBlock()
                        throws java.io.IOException
        Returns the next block or null if none is present.
        Specified by:
        nextBlock in interface IPcapInput
        Returns:
        Next block or null.
        Throws:
        java.io.IOException - if anything went wrong with underlying IO operations.