Builder Class — netty Architecture
Architecture documentation for the Builder class in PcapWriteHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD dce9226c_6441_9831_b2ba_dd2cea71e134["Builder"] f621a1b5_b094_5cfc_94ae_44445a7f7be6["PcapWriteHandler.java"] dce9226c_6441_9831_b2ba_dd2cea71e134 -->|defined in| f621a1b5_b094_5cfc_94ae_44445a7f7be6 c908f1d5_2079_df33_dd86_cef805df5cd9["Builder()"] dce9226c_6441_9831_b2ba_dd2cea71e134 -->|method| c908f1d5_2079_df33_dd86_cef805df5cd9 31f1f9ac_8a34_c2b7_62bd_872db2efc0e5["PcapWriteHandler()"] dce9226c_6441_9831_b2ba_dd2cea71e134 -->|method| 31f1f9ac_8a34_c2b7_62bd_872db2efc0e5
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/pcap/PcapWriteHandler.java lines 810–910
public static final class Builder {
private boolean captureZeroByte;
private boolean sharedOutputStream;
private boolean writePcapGlobalHeader = true;
private ChannelType channelType;
private InetSocketAddress initiatorAddr;
private InetSocketAddress handlerAddr;
private boolean isServerPipeline;
private Builder() {
}
/**
* Set to {@code true} to enable capturing packets with empty (0 bytes) payload. Otherwise, if set to
* {@code false}, empty packets will be filtered out.
*
* @param captureZeroByte Whether to filter out empty packets.
* @return this builder
*/
public Builder captureZeroByte(boolean captureZeroByte) {
this.captureZeroByte = captureZeroByte;
return this;
}
/**
* Set to {@code true} if multiple {@link PcapWriteHandler} instances will be
* writing to the same {@link OutputStream} concurrently, and write locking is
* required. Otherwise, if set to {@code false}, no locking will be done.
* Additionally, {@link #close} will not close the underlying {@code OutputStream}.
* Note: it is probably an error to have both {@code writePcapGlobalHeader} and
* {@code sharedOutputStream} set to {@code true} at the same time.
*
* @param sharedOutputStream Whether {@link OutputStream} is shared or not
* @return this builder
*/
public Builder sharedOutputStream(boolean sharedOutputStream) {
this.sharedOutputStream = sharedOutputStream;
return this;
}
/**
* Set to {@code true} to write Pcap Global Header on initialization. Otherwise, if set to {@code 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.
*
* @param writePcapGlobalHeader Whether to write the pcap global header.
* @return this builder
*/
public Builder writePcapGlobalHeader(boolean writePcapGlobalHeader) {
this.writePcapGlobalHeader = writePcapGlobalHeader;
return this;
}
/**
* 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.
*
* @param serverAddress The address of the TCP server (handler)
* @param clientAddress The address of the TCP client (initiator)
* @param isServerPipeline Whether the handler is part of the server channel
* @return this builder
*/
public Builder forceTcpChannel(InetSocketAddress serverAddress, InetSocketAddress clientAddress,
boolean isServerPipeline) {
channelType = ChannelType.TCP;
handlerAddr = checkNotNull(serverAddress, "serverAddress");
initiatorAddr = checkNotNull(clientAddress, "clientAddress");
this.isServerPipeline = isServerPipeline;
return this;
}
/**
* 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.
* <br>
* Note that even if this method is called, the address information on {@link DatagramPacket} takes precedence
* if it is present.
*
* @param localAddress The address of the UDP local
* @param remoteAddress The address of the UDP remote
Source
Frequently Asked Questions
What is the Builder class?
Builder is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/pcap/PcapWriteHandler.java.
Where is Builder defined?
Builder is defined in handler/src/main/java/io/netty/handler/pcap/PcapWriteHandler.java at line 810.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free