Module org.jnetpcap
Package org.jnetpcap

Interface PcapHandler.OfMemorySegment<U>

Type Parameters:
U - the generic user type
All Superinterfaces:
PcapHandler
Enclosing interface:
PcapHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface PcapHandler.OfMemorySegment<U> extends PcapHandler
OfMemorySegment relies on preview features of the Java platform:
  • OfMemorySegment refers to one or more preview APIs: MemorySegment.
Programs can only use OfMemorySegment when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
An advanced low level, no copy, packet handler. The packets dispatched using this handler are no copied and memory segments reference into native pcap ring-buffer and are only safe to use during the duration of handler call. After the handler returns that packet memory is no longer valid and may throw an exception if tried to access.
  • Method Details

    • handleSegment

      void handleSegment(U user, MemorySegmentPREVIEW header, MemorySegmentPREVIEW Packet)
      Packet handler method. This method get called to handle or consume a pcap packet.
      Parameters:
      user - the user
      header - the header
      Packet - the packet