FastLzFrameDecoder Class — netty Architecture
Architecture documentation for the FastLzFrameDecoder class in FastLzFrameDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 027237ff_2dd9_ddc6_a78e_256023cb6517["FastLzFrameDecoder"] a0a8183c_ce02_b1cc_9aa7_1aa43cc86e52["FastLzFrameDecoder.java"] 027237ff_2dd9_ddc6_a78e_256023cb6517 -->|defined in| a0a8183c_ce02_b1cc_9aa7_1aa43cc86e52 a8a502c8_d2e7_012d_e50b_c77b94d6c1e5["FastLzFrameDecoder()"] 027237ff_2dd9_ddc6_a78e_256023cb6517 -->|method| a8a502c8_d2e7_012d_e50b_c77b94d6c1e5 0eec1c5c_5152_4314_9a45_92a187fc7c63["decode()"] 027237ff_2dd9_ddc6_a78e_256023cb6517 -->|method| 0eec1c5c_5152_4314_9a45_92a187fc7c63
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java lines 36–208
public class FastLzFrameDecoder extends ByteToMessageDecoder {
/**
* Current state of decompression.
*/
private enum State {
INIT_BLOCK,
INIT_BLOCK_PARAMS,
DECOMPRESS_DATA,
CORRUPTED
}
private State currentState = State.INIT_BLOCK;
/**
* Underlying checksum calculator in use.
*/
private final ByteBufChecksum checksum;
/**
* Length of current received chunk of data.
*/
private int chunkLength;
/**
* Original of current received chunk of data.
* It is equal to {@link #chunkLength} for non compressed chunks.
*/
private int originalLength;
/**
* Indicates is this chunk compressed or not.
*/
private boolean isCompressed;
/**
* Indicates is this chunk has checksum or not.
*/
private boolean hasChecksum;
/**
* Checksum value of current received chunk of data which has checksum.
*/
private int currentChecksum;
/**
* Creates the fastest FastLZ decoder without checksum calculation.
*/
public FastLzFrameDecoder() {
this(false);
}
/**
* Creates a FastLZ decoder with calculation of checksums as specified.
*
* @param validateChecksums
* If true, the checksum field will be validated against the actual
* uncompressed data, and if the checksums do not match, a suitable
* {@link DecompressionException} will be thrown.
* Note, that in this case decoder will use {@link java.util.zip.Adler32}
* as a default checksum calculator.
*/
public FastLzFrameDecoder(boolean validateChecksums) {
this(validateChecksums ? new Adler32() : null);
}
/**
* Creates a FastLZ decoder with specified checksum calculator.
*
* @param checksum
* the {@link Checksum} instance to use to check data for integrity.
* You may set {@code null} if you do not want to validate checksum of each block.
*/
public FastLzFrameDecoder(Checksum checksum) {
this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum);
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
try {
switch (currentState) {
case INIT_BLOCK:
Defined In
Source
Frequently Asked Questions
What is the FastLzFrameDecoder class?
FastLzFrameDecoder is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java.
Where is FastLzFrameDecoder defined?
FastLzFrameDecoder is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free