Lz4FrameEncoder Class — netty Architecture
Architecture documentation for the Lz4FrameEncoder class in Lz4FrameEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4a29aef3_e017_5f9e_e255_496a25a8988e["Lz4FrameEncoder"] 068f9b3a_8e6e_e65d_f914_b3fda7c2e51c["Lz4FrameEncoder.java"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|defined in| 068f9b3a_8e6e_e65d_f914_b3fda7c2e51c fa2886b8_d084_ee66_b29e_c6ae65c0c63f["Lz4FrameEncoder()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| fa2886b8_d084_ee66_b29e_c6ae65c0c63f 9f583ec4_1974_3ff8_e0e2_aaa8876b6b61["compressionLevel()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 9f583ec4_1974_3ff8_e0e2_aaa8876b6b61 c63be18d_10be_7a4a_913f_fd8201758452["ByteBuf()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| c63be18d_10be_7a4a_913f_fd8201758452 2f6f9195_61e1_597f_53c0_b36ef1d7b36a["encode()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 2f6f9195_61e1_597f_53c0_b36ef1d7b36a 159fbf77_5b7d_bd62_3287_8d2df4c59091["flushBufferedData()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 159fbf77_5b7d_bd62_3287_8d2df4c59091 685f3ff0_d3ac_dc7e_e9b8_0f821240ad37["flush()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 685f3ff0_d3ac_dc7e_e9b8_0f821240ad37 d42f2a9d_aec3_3afd_815f_5642220dd27c["ChannelFuture()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| d42f2a9d_aec3_3afd_815f_5642220dd27c a0134922_0953_a9fc_e6c5_dceec8fe86f2["isClosed()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| a0134922_0953_a9fc_e6c5_dceec8fe86f2 1af2b43f_f1c2_5b2c_0484_9717d55d4135["close()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 1af2b43f_f1c2_5b2c_0484_9717d55d4135 8c16b044_1da0_3791_1b7f_5dd5a3dbf252["ChannelHandlerContext()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 8c16b044_1da0_3791_1b7f_5dd5a3dbf252 33afe1e4_5f3e_e319_9a62_7f019754d521["handlerAdded()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 33afe1e4_5f3e_e319_9a62_7f019754d521 18af73c6_bd78_e370_5108_f9af43156a4b["handlerRemoved()"] 4a29aef3_e017_5f9e_e255_496a25a8988e -->|method| 18af73c6_bd78_e370_5108_f9af43156a4b
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java lines 67–403
public class Lz4FrameEncoder extends MessageToByteEncoder<ByteBuf> {
static final int DEFAULT_MAX_ENCODE_SIZE = Integer.MAX_VALUE;
private final int blockSize;
/**
* Underlying compressor in use.
*/
private final LZ4Compressor compressor;
/**
* Underlying checksum calculator in use.
*/
private final ByteBufChecksum checksum;
/**
* Compression level of current LZ4 encoder (depends on {@link #blockSize}).
*/
private final int compressionLevel;
/**
* Inner byte buffer for outgoing data. It's capacity will be {@link #blockSize}.
*/
private ByteBuf buffer;
/**
* Maximum size for any buffer to write encoded (compressed) data into.
*/
private final int maxEncodeSize;
/**
* Indicates if the compressed stream has been finished.
*/
private volatile boolean finished;
/**
* Used to interact with its {@link ChannelPipeline} and other handlers.
*/
private volatile ChannelHandlerContext ctx;
/**
* Creates the fastest LZ4 encoder with default block size (64 KB)
* and xxhash hashing for Java, based on Yann Collet's work available at
* <a href="https://github.com/Cyan4973/xxHash">Github</a>.
*/
public Lz4FrameEncoder() {
this(false);
}
/**
* Creates a new LZ4 encoder with hight or fast compression, default block size (64 KB)
* and xxhash hashing for Java, based on Yann Collet's work available at
* <a href="https://github.com/Cyan4973/xxHash">Github</a>.
*
* @param highCompressor if {@code true} codec will use compressor which requires more memory
* and is slower but compresses more efficiently
*/
public Lz4FrameEncoder(boolean highCompressor) {
this(LZ4Factory.fastestInstance(), highCompressor, DEFAULT_BLOCK_SIZE, new Lz4XXHash32(DEFAULT_SEED));
}
/**
* Creates a new customizable LZ4 encoder.
*
* @param factory user customizable {@link LZ4Factory} instance
* which may be JNI bindings to the original C implementation, a pure Java implementation
* or a Java implementation that uses the {@link sun.misc.Unsafe}
* @param highCompressor if {@code true} codec will use compressor which requires more memory
* and is slower but compresses more efficiently
* @param blockSize the maximum number of bytes to try to compress at once,
* must be >= 64 and <= 32 M
* @param checksum the {@link Checksum} instance to use to check data for integrity
*/
public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum) {
this(factory, highCompressor, blockSize, checksum, DEFAULT_MAX_ENCODE_SIZE);
}
/**
* Creates a new customizable LZ4 encoder.
*
* @param factory user customizable {@link LZ4Factory} instance
Source
Frequently Asked Questions
What is the Lz4FrameEncoder class?
Lz4FrameEncoder is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java.
Where is Lz4FrameEncoder defined?
Lz4FrameEncoder is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java at line 67.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free