SevenZipLZMACompressionSettings

Inheritance: java.lang.Object, com.aspose.zip.SevenZipCompressionSettings

public class SevenZipLZMACompressionSettings extends SevenZipCompressionSettings

Settings for LZMA compression method within 7z archive.

The Lempel\u2013Ziv\u2013Markov chain algorithm (LZMA) is an algorithm used to perform lossless data compression. This algorithm uses a dictionary compression scheme somewhat similar to the LZ77 algorithm and features a high compression ratio and a variable compression-dictionary size.

See more: Lempel\u2013Ziv\u2013Markov chain algorithm

Constructors

ConstructorDescription
SevenZipLZMACompressionSettings()Initializes a new instance of the SevenZipLZMACompressionSettings class with default parameters.
SevenZipLZMACompressionSettings(int dictionarySize, int numberOfFastBytes, int literalContextBits)Initializes a new instance of the SevenZipLZMACompressionSettings class with specified dictionary size, number of fast bytes and number of literal context bits.
SevenZipLZMACompressionSettings(int dictionarySize)Initializes a new instance of the SevenZipLZMACompressionSettings class with specified dictionary size, number of fast bytes equal to 32, number of literal context bits equal to 3.

Methods

MethodDescription
getDictionarySize()Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory.
getLiteralContextBits()Gets the number of literal context bits.
getMethod()Gets compression or decompression method.
getNumberOfFastBytes()Gets the number of bytes used for fast match searching in the LZMA algorithm.
setDictionarySize(int value)Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory.

SevenZipLZMACompressionSettings()

public SevenZipLZMACompressionSettings()

Initializes a new instance of the SevenZipLZMACompressionSettings class with default parameters.


     try (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipLZMACompressionSettings()))) {
         archive.createEntry("data.bin", "data.bin");
         archive.save("result.7z");
 }
 

SevenZipLZMACompressionSettings(int dictionarySize, int numberOfFastBytes, int literalContextBits)

public SevenZipLZMACompressionSettings(int dictionarySize, int numberOfFastBytes, int literalContextBits)

Initializes a new instance of the SevenZipLZMACompressionSettings class with specified dictionary size, number of fast bytes and number of literal context bits.

Parameters:

ParameterTypeDescription
dictionarySizeintDictionary (history buffer) size in bytes. Must be between 4096 and 1073741824, or equal to zero for automatic detection based on entry size.
numberOfFastBytesintThe number of bytes used for fast match searching in the LZMA algorithm. Can be in the range from 5 to 273.
literalContextBitsintSets the number of literal context bits (high bits of previous literal). It can be in range from 0 to 8.

SevenZipLZMACompressionSettings(int dictionarySize)

public SevenZipLZMACompressionSettings(int dictionarySize)

Initializes a new instance of the SevenZipLZMACompressionSettings class with specified dictionary size, number of fast bytes equal to 32, number of literal context bits equal to 3.

Parameters:

ParameterTypeDescription
dictionarySizeintDictionary (history buffer) size in bytes. Must be between 4096 and 1073741824, or equal to zero for automatic detection based on entry size.

getDictionarySize()

public final int getDictionarySize()

Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory. If not set, will be chosen accordingly to entry size. Must be between 4096 and 1073741824, or equal to zero for automatic detection based on entry size.

The bigger the dictionary, usually the better the compression ratio is - but dictionaries larger than the uncompressed data are a waste of RAM.

Returns: int - dictionary (history buffer) size

getLiteralContextBits()

public final int getLiteralContextBits()

Gets the number of literal context bits.

Literal Context Bits define how many of the most significant bits of the previous uncompressed byte are used to predict the bits of the next literal byte. Must be from 0 to 8.

Returns: int - the number of literal context bits.

getMethod()

public SevenZipCompressionMethod getMethod()

Gets compression or decompression method.

Returns: SevenZipCompressionMethod - compression or decompression method

getNumberOfFastBytes()

public final int getNumberOfFastBytes()

Gets the number of bytes used for fast match searching in the LZMA algorithm.

A higher value allows the compressor to search longer matches, which can improve the compression ratio slightly but slows down compression.

Returns: int - the number of bytes used for fast match searching in the LZMA algorithm.

setDictionarySize(int value)

public final void setDictionarySize(int value)

Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data is kept in memory. If not set, will be chosen accordingly to entry size. Must be between 4096 and 1073741824, or equal to zero for automatic detection based on entry size.

The bigger the dictionary, usually the better the compression ratio is - but dictionaries larger than the uncompressed data are a waste of RAM.

Parameters:

ParameterTypeDescription
valueintdictionary (history buffer) size