public static final class PcapWriteHandler.Builder
extends java.lang.Object
PcapWriteHandler
限定符和类型 | 方法和说明 |
---|---|
PcapWriteHandler |
build(java.io.OutputStream outputStream)
Build the
PcapWriteHandler . |
PcapWriteHandler.Builder |
captureZeroByte(boolean captureZeroByte)
Set to
true 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 to
true if multiple PcapWriteHandler instances will be
writing to the same OutputStream concurrently, and write locking is
required. |
PcapWriteHandler.Builder |
writePcapGlobalHeader(boolean writePcapGlobalHeader)
Set to
true to write Pcap Global Header on initialization. |
public PcapWriteHandler.Builder captureZeroByte(boolean captureZeroByte)
true
to enable capturing packets with empty (0 bytes) payload. Otherwise, if set to
false
, empty packets will be filtered out.captureZeroByte
- Whether to filter out empty packets.public PcapWriteHandler.Builder sharedOutputStream(boolean sharedOutputStream)
true
if multiple PcapWriteHandler
instances will be
writing to the same OutputStream
concurrently, and write locking is
required. Otherwise, if set to false
, no locking will be done.
Additionally, PcapWriteHandler.close()
will not close the underlying OutputStream
.
Note: it is probably an error to have both writePcapGlobalHeader
and
sharedOutputStream
set to true
at the same time.sharedOutputStream
- Whether OutputStream
is shared or notpublic PcapWriteHandler.Builder writePcapGlobalHeader(boolean writePcapGlobalHeader)
true
to write Pcap Global Header on initialization. Otherwise, if set to false
, 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.writePcapGlobalHeader
- Whether to write the pcap global header.public PcapWriteHandler.Builder forceTcpChannel(java.net.InetSocketAddress serverAddress, java.net.InetSocketAddress clientAddress, boolean isServerPipeline)
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 channelpublic PcapWriteHandler.Builder forceUdpChannel(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress)
DatagramPacket
takes precedence
if it is present.localAddress
- The address of the UDP localremoteAddress
- The address of the UDP remotepublic PcapWriteHandler build(java.io.OutputStream outputStream)
PcapWriteHandler
.outputStream
- The output stream to write the pcap data to.