Top Fields Constructors Methods
org.tukaani.xz.lzma

pack-priv final Class LZMAEncoderNormal

extends LZMAEncoder
Class Inheritance
Imports
org.tukaani.xz.ArrayCache, org.tukaani.xz.lz.LZEncoder, .Matches, org.tukaani.xz.rangecoder.RangeEncoder

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private Matches
private final State
private int
private int
private static final int
private final Optimum[]
private final int[]
Inherited from org.tukaani.xz.lzma.LZMAEncoder:
backliteralEncoderlzmatchLenEncoderMODE_FASTMODE_NORMALniceLenreadAheadrepLenEncoder

Constructor Summary

AccessConstructor and Description
pack-priv
LZMAEncoderNormal(RangeEncoder rc, int lc, int lp, int pb, int dictSize, int extraSizeBefore, int niceLen, int mf, int depthLimit, ArrayCache arrayCache)

Method Summary

Modifier and TypeMethod and Description
private void
calc1BytePrices(int pos, int posState, int avail, int anyRepPrice)

Calculates prices of a literal, a short rep, and literal + rep0.

private int
calcLongRepPrices(int pos, int posState, int avail, int anyRepPrice)

Calculates prices of long rep and long rep + literal + rep0.

private void
calcNormalMatchPrices(int pos, int posState, int avail, int anyMatchPrice, int startLen)

Calculates prices of a normal match and normal match + literal + rep0.

private int
convertOpts()

Converts the opts array from backward indexes to forward indexes.

pack-priv static int
getMemoryUsage(int dictSize, int extraSizeBefore, int mf)

pack-priv int
getNextSymbol()

Implements abstract org.tukaani.xz.lzma.LZMAEncoder.getNextSymbol.

Gets the next LZMA symbol.
public void
private void
updateOptStateAndReps()

Updates the state and reps for the current byte in the opts array.

Inherited from org.tukaani.xz.lzma.LZMAEncoder:
encodeForLZMA1encodeForLZMA2encodeLZMA1EndMarkergetAnyMatchPricegetAnyRepPricegetDistSlotgetInstancegetLongRepAndLenPricegetLongRepPricegetLZEncodergetMatchAndLenPricegetMatchesgetMemoryUsagegetNormalMatchPricegetShortRepPricegetUncompressedSizeputArraysToCacheresetUncompressedSizeskipupdatePrices

Field Detail

EXTRA_SIZE_AFTERback to summary
private static final int EXTRA_SIZE_AFTER
EXTRA_SIZE_BEFOREback to summary
private static final int EXTRA_SIZE_BEFORE
matchesback to summary
private Matches matches
nextStateback to summary
private final State nextState
optCurback to summary
private int optCur
optEndback to summary
private int optEnd
OPTSback to summary
private static final int OPTS
optsback to summary
private final Optimum[] opts
repLensback to summary
private final int[] repLens

Constructor Detail

LZMAEncoderNormalback to summary
pack-priv LZMAEncoderNormal(RangeEncoder rc, int lc, int lp, int pb, int dictSize, int extraSizeBefore, int niceLen, int mf, int depthLimit, ArrayCache arrayCache)

Method Detail

calc1BytePricesback to summary
private void calc1BytePrices(int pos, int posState, int avail, int anyRepPrice)

Calculates prices of a literal, a short rep, and literal + rep0.

calcLongRepPricesback to summary
private int calcLongRepPrices(int pos, int posState, int avail, int anyRepPrice)

Calculates prices of long rep and long rep + literal + rep0.

calcNormalMatchPricesback to summary
private void calcNormalMatchPrices(int pos, int posState, int avail, int anyMatchPrice, int startLen)

Calculates prices of a normal match and normal match + literal + rep0.

convertOptsback to summary
private int convertOpts()

Converts the opts array from backward indexes to forward indexes. Then it will be simple to get the next symbol from the array in later calls to getNextSymbol().

getMemoryUsageback to summary
pack-priv static int getMemoryUsage(int dictSize, int extraSizeBefore, int mf)
getNextSymbolback to summary
pack-priv int getNextSymbol()

Implements abstract org.tukaani.xz.lzma.LZMAEncoder.getNextSymbol.

Doc from org.tukaani.xz.lzma.LZMAEncoder.getNextSymbol.

Gets the next LZMA symbol.

There are three types of symbols: literal (a single byte), repeated match, and normal match. The symbol is indicated by the return value and by the variable back.

Literal: back == -1 and return value is 1. The literal itself needs to be read from lz separately.

Repeated match: back is in the range [0, 3] and the return value is the length of the repeated match.

Normal match: back - REPS (back - 4) is the distance of the match and the return value is the length of the match.

resetback to summary
public void reset()

Overrides org.tukaani.xz.lzma.LZMAEncoder.reset.

updateOptStateAndRepsback to summary
private void updateOptStateAndReps()

Updates the state and reps for the current byte in the opts array.