Class Parameters.Builder

    • Method Detail

      • withMinBackReferenceLength

        public Parameters.Builder withMinBackReferenceLength​(int minBackReferenceLength)
        Sets the minimal length of a back-reference.

        Ensures maxBackReferenceLength is not smaller than minBackReferenceLength.

        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:
        minBackReferenceLength - the minimal length of a back-reference found. A true minimum of 3 is hard-coded inside of this implementation but bigger lengths can be configured.
        Returns:
        the builder
        Throws:
        IllegalArgumentException - if windowSize is smaller than minBackReferenceLength.
      • withMaxBackReferenceLength

        public Parameters.Builder withMaxBackReferenceLength​(int maxBackReferenceLength)
        Sets the maximal length of a back-reference.

        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:
        maxBackReferenceLength - maximal length of a back-reference found. A value smaller than minBackReferenceLength is interpreted as minBackReferenceLength. maxBackReferenceLength is capped at windowSize - 1.
        Returns:
        the builder
      • withMaxOffset

        public Parameters.Builder withMaxOffset​(int maxOffset)
        Sets the maximal offset of a back-reference.

        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:
        maxOffset - maximal offset of a back-reference. A non-positive value as well as values bigger than windowSize - 1 are interpreted as windowSize - 1.
        Returns:
        the builder
      • withMaxLiteralLength

        public Parameters.Builder withMaxLiteralLength​(int maxLiteralLength)
        Sets the maximal length of a literal block.

        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:
        maxLiteralLength - maximal length of a literal block. Negative numbers and 0 as well as values bigger than windowSize are interpreted as windowSize.
        Returns:
        the builder
      • withNiceBackReferenceLength

        public Parameters.Builder withNiceBackReferenceLength​(int niceLen)
        Sets the "nice length" of a back-reference.

        When a back-references if this size has been found, stop searching for longer back-references.

        This settings can be used to tune the tradeoff between compression speed and compression ratio.

        Parameters:
        niceLen - the "nice length" of a back-reference
        Returns:
        the builder
      • withMaxNumberOfCandidates

        public Parameters.Builder withMaxNumberOfCandidates​(int maxCandidates)
        Sets the maximum number of back-reference candidates that should be consulted.

        This settings can be used to tune the tradeoff between compression speed and compression ratio.

        Parameters:
        maxCandidates - maximum number of back-reference candidates
        Returns:
        the builder
      • withLazyMatching

        public Parameters.Builder withLazyMatching​(boolean lazy)
        Sets whether lazy matching should be performed.

        Lazy matching means that after a back-reference for a certain position has been found the compressor will try to find a longer match for the next position.

        Lazy matching is enabled by default and disabled when tuning for speed.

        Parameters:
        lazy - whether lazy matching should be performed
        Returns:
        the builder
      • withLazyThreshold

        public Parameters.Builder withLazyThreshold​(int threshold)
        Sets the threshold for lazy matching.

        Even if lazy matching is enabled it will not be performed if the length of the back-reference found for the current position is longer than this value.

        Parameters:
        threshold - the threshold for lazy matching
        Returns:
        the builder
      • tunedForSpeed

        public Parameters.Builder tunedForSpeed()
        Changes the default setting for "nice back-reference length" and "maximum number of candidates" for improved compression speed at the cost of compression ratio.

        Use this method after configuring "maximum back-reference length".

        Returns:
        the builder
      • tunedForCompressionRatio

        public Parameters.Builder tunedForCompressionRatio()
        Changes the default setting for "nice back-reference length" and "maximum number of candidates" for improved compression ratio at the cost of compression speed.

        Use this method after configuring "maximum back-reference length".

        Returns:
        the builder