Class Parameters
- java.lang.Object
-
- org.apache.commons.compress.compressors.lz77support.Parameters
-
public final class Parameters extends java.lang.Object
Parameters of thecompressor
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Parameters.Builder
Builder forParameters
instances.
-
Field Summary
Fields Modifier and Type Field Description private boolean
lazyMatching
private int
lazyThreshold
private int
maxBackReferenceLength
private int
maxCandidates
private int
maxLiteralLength
private int
maxOffset
private int
minBackReferenceLength
private int
niceBackReferenceLength
static int
TRUE_MIN_BACK_REFERENCE_LENGTH
The hard-coded absolute minimal length of a back-reference.private int
windowSize
-
Constructor Summary
Constructors Modifier Constructor Description private
Parameters(int windowSize, int minBackReferenceLength, int maxBackReferenceLength, int maxOffset, int maxLiteralLength, int niceBackReferenceLength, int maxCandidates, boolean lazyMatching, int lazyThreshold)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Parameters.Builder
builder(int windowSize)
Initializes the builder for the compressor's parameters with aminBackReferenceLength
of 3 andmax*Length
equal towindowSize - 1
.boolean
getLazyMatching()
Gets whether to perform lazy matching.int
getLazyMatchingThreshold()
Gets the threshold for lazy matching.int
getMaxBackReferenceLength()
Gets the maximal length of a back-reference found.int
getMaxCandidates()
Gets the maximum number of back-reference candidates to consider.int
getMaxLiteralLength()
Gets the maximal length of a literal block.int
getMaxOffset()
Gets the maximal offset of a back-reference found.int
getMinBackReferenceLength()
Gets the minimal length of a back-reference found.int
getNiceBackReferenceLength()
Gets the length of a back-reference that is considered nice enough to stop searching for longer ones.int
getWindowSize()
Gets the size of the sliding window - this determines the maximum offset a back-reference can take.private static boolean
isPowerOfTwo(int x)
-
-
-
Field Detail
-
TRUE_MIN_BACK_REFERENCE_LENGTH
public static final int TRUE_MIN_BACK_REFERENCE_LENGTH
The hard-coded absolute minimal length of a back-reference.- See Also:
- Constant Field Values
-
windowSize
private final int windowSize
-
minBackReferenceLength
private final int minBackReferenceLength
-
maxBackReferenceLength
private final int maxBackReferenceLength
-
maxOffset
private final int maxOffset
-
maxLiteralLength
private final int maxLiteralLength
-
niceBackReferenceLength
private final int niceBackReferenceLength
-
maxCandidates
private final int maxCandidates
-
lazyThreshold
private final int lazyThreshold
-
lazyMatching
private final boolean lazyMatching
-
-
Method Detail
-
builder
public static Parameters.Builder builder(int windowSize)
Initializes the builder for the compressor's parameters with aminBackReferenceLength
of 3 andmax*Length
equal towindowSize - 1
.It is recommended to not use this method directly but rather tune a pre-configured builder created by a format specific factory like
SnappyCompressorOutputStream.createParameterBuilder(int)
.- Parameters:
windowSize
- the size of the sliding window - this determines the maximum offset a back-reference can take. Must be a power of two.- Returns:
- a builder configured for the given window size
- Throws:
java.lang.IllegalArgumentException
- if windowSize is not a power of two.
-
getWindowSize
public int getWindowSize()
Gets the size of the sliding window - this determines the maximum offset a back-reference can take.- Returns:
- the size of the sliding window
-
getMinBackReferenceLength
public int getMinBackReferenceLength()
Gets the minimal length of a back-reference found.- Returns:
- the minimal length of a back-reference found
-
getMaxBackReferenceLength
public int getMaxBackReferenceLength()
Gets the maximal length of a back-reference found.- Returns:
- the maximal length of a back-reference found
-
getMaxOffset
public int getMaxOffset()
Gets the maximal offset of a back-reference found.- Returns:
- the maximal offset of a back-reference found
-
getMaxLiteralLength
public int getMaxLiteralLength()
Gets the maximal length of a literal block.- Returns:
- the maximal length of a literal block
-
getNiceBackReferenceLength
public int getNiceBackReferenceLength()
Gets the length of a back-reference that is considered nice enough to stop searching for longer ones.- Returns:
- the length of a back-reference that is considered nice enough to stop searching
-
getMaxCandidates
public int getMaxCandidates()
Gets the maximum number of back-reference candidates to consider.- Returns:
- the maximum number of back-reference candidates to consider
-
getLazyMatching
public boolean getLazyMatching()
Gets whether to perform lazy matching.- Returns:
- whether to perform lazy matching
-
getLazyMatchingThreshold
public int getLazyMatchingThreshold()
Gets the threshold for lazy matching.- Returns:
- the threshold for lazy matching
-
isPowerOfTwo
private static final boolean isPowerOfTwo(int x)
-
-