Package io.netty.handler.pcap
Class PcapWriteHandler.Builder
- java.lang.Object
-
- io.netty.handler.pcap.PcapWriteHandler.Builder
-
- Enclosing class:
- PcapWriteHandler
public static final class PcapWriteHandler.Builder extends java.lang.Object
Builder forPcapWriteHandler
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PcapWriteHandler
build(java.io.OutputStream outputStream)
Build thePcapWriteHandler
.PcapWriteHandler.Builder
captureZeroByte(boolean captureZeroByte)
Set totrue
to enable capturing packets with empty (0 bytes) payload.PcapWriteHandler.Builder
forceTcpChannel(java.net.InetSocketAddress serverAddress, java.net.InetSocketAddress clientAddress, boolean isServerPipeline)
Force this handler to write data as if they were TCP packets, with the given connection metadata.PcapWriteHandler.Builder
forceUdpChannel(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress)
Force this handler to write data as if they were UDP packets, with the given connection metadata.PcapWriteHandler.Builder
sharedOutputStream(boolean sharedOutputStream)
Set totrue
if multiplePcapWriteHandler
instances will be writing to the sameOutputStream
concurrently, and write locking is required.PcapWriteHandler.Builder
writePcapGlobalHeader(boolean writePcapGlobalHeader)
Set totrue
to write Pcap Global Header on initialization.
-
-
-
Method Detail
-
captureZeroByte
public PcapWriteHandler.Builder captureZeroByte(boolean captureZeroByte)
Set totrue
to enable capturing packets with empty (0 bytes) payload. Otherwise, if set tofalse
, empty packets will be filtered out.- Parameters:
captureZeroByte
- Whether to filter out empty packets.- Returns:
- this builder
-
sharedOutputStream
public PcapWriteHandler.Builder sharedOutputStream(boolean sharedOutputStream)
Set totrue
if multiplePcapWriteHandler
instances will be writing to the sameOutputStream
concurrently, and write locking is required. Otherwise, if set tofalse
, no locking will be done. Additionally,PcapWriteHandler.close()
will not close the underlyingOutputStream
. Note: it is probably an error to have bothwritePcapGlobalHeader
andsharedOutputStream
set totrue
at the same time.- Parameters:
sharedOutputStream
- WhetherOutputStream
is shared or not- Returns:
- this builder
-
writePcapGlobalHeader
public PcapWriteHandler.Builder writePcapGlobalHeader(boolean writePcapGlobalHeader)
Set totrue
to write Pcap Global Header on initialization. Otherwise, if set tofalse
, Pcap Global Header will not be written on initialization. This could when writing Pcap data on a existing file where Pcap Global Header is already present.- Parameters:
writePcapGlobalHeader
- Whether to write the pcap global header.- Returns:
- this builder
-
forceTcpChannel
public PcapWriteHandler.Builder forceTcpChannel(java.net.InetSocketAddress serverAddress, java.net.InetSocketAddress clientAddress, boolean isServerPipeline)
Force this handler to write data as if they were TCP packets, with the given connection metadata. If this method isn't called, we determine the metadata from the channel.- Parameters:
serverAddress
- The address of the TCP server (handler)clientAddress
- The address of the TCP client (initiator)isServerPipeline
- Whether the handler is part of the server channel- Returns:
- this builder
-
forceUdpChannel
public PcapWriteHandler.Builder forceUdpChannel(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress)
Force this handler to write data as if they were UDP packets, with the given connection metadata. If this method isn't called, we determine the metadata from the channel.
Note that even if this method is called, the address information onDatagramPacket
takes precedence if it is present.- Parameters:
localAddress
- The address of the UDP localremoteAddress
- The address of the UDP remote- Returns:
- this builder
-
build
public PcapWriteHandler build(java.io.OutputStream outputStream)
Build thePcapWriteHandler
.- Parameters:
outputStream
- The output stream to write the pcap data to.- Returns:
- The handler.
-
-