Home / Class/ LzmaFrameEncoder Class — netty Architecture

LzmaFrameEncoder Class — netty Architecture

Architecture documentation for the LzmaFrameEncoder class in LzmaFrameEncoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7c9ec182_4df7_b0e1_b1a7_861a5a612786["LzmaFrameEncoder"]
  88553871_276f_8d21_d3ef_a72096a80c71["LzmaFrameEncoder.java"]
  7c9ec182_4df7_b0e1_b1a7_861a5a612786 -->|defined in| 88553871_276f_8d21_d3ef_a72096a80c71
  4218a796_32e8_047c_859f_7db985e5efa9["LzmaFrameEncoder()"]
  7c9ec182_4df7_b0e1_b1a7_861a5a612786 -->|method| 4218a796_32e8_047c_859f_7db985e5efa9
  619df49c_b471_d88b_5b8f_43b4f230efa9["encode()"]
  7c9ec182_4df7_b0e1_b1a7_861a5a612786 -->|method| 619df49c_b471_d88b_5b8f_43b4f230efa9
  d26f5bcc_2a66_b7f8_d1e3_e9e2eb77d7fe["ByteBuf()"]
  7c9ec182_4df7_b0e1_b1a7_861a5a612786 -->|method| d26f5bcc_2a66_b7f8_d1e3_e9e2eb77d7fe
  8a3b26a2_22a8_e061_7150_1eb375301713["maxOutputBufferLength()"]
  7c9ec182_4df7_b0e1_b1a7_861a5a612786 -->|method| 8a3b26a2_22a8_e061_7150_1eb375301713

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/LzmaFrameEncoder.java lines 39–213

public class LzmaFrameEncoder extends MessageToByteEncoder<ByteBuf> {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(LzmaFrameEncoder.class);

    private static final int MEDIUM_DICTIONARY_SIZE = 1 << 16;

    private static final int MIN_FAST_BYTES = 5;
    private static final int MEDIUM_FAST_BYTES = 0x20;
    private static final int MAX_FAST_BYTES = Base.kMatchMaxLen;

    private static final int DEFAULT_MATCH_FINDER = EMatchFinderTypeBT4;

    private static final int DEFAULT_LC = 3;
    private static final int DEFAULT_LP = 0;
    private static final int DEFAULT_PB = 2;

    /**
     * Underlying LZMA encoder in use.
     */
    private final Encoder encoder;

    /**
     * The Properties field contains three properties which are encoded using the following formula:
     *
     * <p>{@code Properties = (pb * 5 + lp) * 9 + lc}</p>
     *
     * The field consists of
     *  <ol>
     *      <li>the number of literal context bits (lc, [0, 8]);</li>
     *      <li>the number of literal position bits (lp, [0, 4]);</li>
     *      <li>the number of position bits (pb, [0, 4]).</li>
     *  </ol>
     */
    private final byte properties;

    /**
     * Dictionary Size is stored as an unsigned 32-bit little endian integer.
     */
    private final int littleEndianDictionarySize;

    /**
     * For log warning only once.
     */
    private static boolean warningLogged;

    /**
     * Creates LZMA encoder with default settings.
     */
    public LzmaFrameEncoder() {
        this(MEDIUM_DICTIONARY_SIZE);
    }

    /**
     * Creates LZMA encoder with specified {@code lc}, {@code lp}, {@code pb}
     * values and the medium dictionary size of {@value #MEDIUM_DICTIONARY_SIZE}.
     */
    public LzmaFrameEncoder(int lc, int lp, int pb) {
        this(lc, lp, pb, MEDIUM_DICTIONARY_SIZE);
    }

    /**
     * Creates LZMA encoder with specified dictionary size and default values of
     * {@code lc} = {@value #DEFAULT_LC},
     * {@code lp} = {@value #DEFAULT_LP},
     * {@code pb} = {@value #DEFAULT_PB}.
     */
    public LzmaFrameEncoder(int dictionarySize) {
        this(DEFAULT_LC, DEFAULT_LP, DEFAULT_PB, dictionarySize);
    }

    /**
     * Creates LZMA encoder with specified {@code lc}, {@code lp}, {@code pb} values and custom dictionary size.
     */
    public LzmaFrameEncoder(int lc, int lp, int pb, int dictionarySize) {
        this(lc, lp, pb, dictionarySize, false, MEDIUM_FAST_BYTES);
    }

    /**
     * Creates LZMA encoder with specified settings.
     *
     * @param lc

Frequently Asked Questions

What is the LzmaFrameEncoder class?
LzmaFrameEncoder is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/LzmaFrameEncoder.java.
Where is LzmaFrameEncoder defined?
LzmaFrameEncoder is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/LzmaFrameEncoder.java at line 39.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free