XzArchiveSettings

Inheritance: java.lang.Object

public class XzArchiveSettings

The class contains set of setting particular xz archive.

Constructors

ConstructorDescription
XzArchiveSettings()Initializes a new instance of the XzArchiveSettings class using single LZMA2 compression.
XzArchiveSettings(XzFilterSettings[] filters, long blockSize, XzCheckType checkType)Initializes a new instance of the XzArchiveSettings class with custom parameters.

Methods

MethodDescription
getCompressionThreads()Gets compression thread count.
getFastSpeed()Gets the instance of the XzArchiveSettings class with dictionary size equals to 1 megabyte in LZMA2 filter, block size equals to 4 megabytes and CRC32 checksum.
getFastestSpeed()Gets the instance of the XzArchiveSettings class with dictionary size equals to 65536 bytes in LZMA2 filter, block size equals to 1 megabyte and CRC32 checksum.
getHighCompression()Gets the instance of the XzArchiveSettings class with dictionary size equals to 32 megabytes in LZMA2 filter, block size equals to 128 megabytes and CRC32 checksum.
getMaximumCompression()Gets the instance of the XzArchiveSettings class with dictionary size equals to 64 megabytes in LZMA2 filter, block size equals to 256 megabytes and CRC32 checksum.
getNormal()Gets the instance of the XzArchiveSettings class with dictionary size equals to 16 megabytes in LZMA2 filter, block size equals to 64 megabytes and CRC32 checksum.
setCompressionThreads(int value)Sets compression thread count.

XzArchiveSettings()

public XzArchiveSettings()

Initializes a new instance of the XzArchiveSettings class using single LZMA2 compression.

Default dictionary in LZMA2 filter size equals to 16 megabyte, default block size equals to 64 megabytes, default checksum type is CRC32.

XzArchiveSettings(XzFilterSettings[] filters, long blockSize, XzCheckType checkType)

public XzArchiveSettings(XzFilterSettings[] filters, long blockSize, XzCheckType checkType)

Initializes a new instance of the XzArchiveSettings class with custom parameters.


     try (FileOutputStream xzFile = new FileOutputStream("archive.xz")) {
         XzLZMA2FilterSettings filter = new XzLZMA2FilterSettings(5242880);
         XzArchiveSettings settings = new XzArchiveSettings(new XzFilterSettings[] {filter}, 10485760, XzCheckType.Crc32);
         try (XzArchive archive = new XzArchive(settings)) {
             archive.setSource("data.bin");
             archive.save(xzFile);
         }
     } catch (IOException ex) {
     }
 

Parameters:

ParameterTypeDescription
filtersXzFilterSettings[]filters (compressors) to be sequentially applied to create XzArchive. It can be either single XzLZMA2FilterSettings or pair of XzBcjX86FilterSettings and XzLZMA2FilterSettings
blockSizelongsize xz archive block
checkTypeXzCheckTypetype of checksum calculation for uncompressed data

getCompressionThreads()

public final int getCompressionThreads()

Gets compression thread count. If the value greater than 1, multithreading compression will be used.

Returns: int - compression thread count

getFastSpeed()

public static XzArchiveSettings getFastSpeed()

Gets the instance of the XzArchiveSettings class with dictionary size equals to 1 megabyte in LZMA2 filter, block size equals to 4 megabytes and CRC32 checksum.

Returns: XzArchiveSettings - the instance of the XzArchiveSettings class with parameters for the fast speed

getFastestSpeed()

public static XzArchiveSettings getFastestSpeed()

Gets the instance of the XzArchiveSettings class with dictionary size equals to 65536 bytes in LZMA2 filter, block size equals to 1 megabyte and CRC32 checksum.

Returns: XzArchiveSettings - the instance of the XzArchiveSettings class with parameters for the fastest speed

getHighCompression()

public static XzArchiveSettings getHighCompression()

Gets the instance of the XzArchiveSettings class with dictionary size equals to 32 megabytes in LZMA2 filter, block size equals to 128 megabytes and CRC32 checksum.

Returns: XzArchiveSettings - the instance of the XzArchiveSettings class with parameters for the high compression

getMaximumCompression()

public static XzArchiveSettings getMaximumCompression()

Gets the instance of the XzArchiveSettings class with dictionary size equals to 64 megabytes in LZMA2 filter, block size equals to 256 megabytes and CRC32 checksum.

Returns: XzArchiveSettings - the instance of the XzArchiveSettings class with parameters for the maximum compression

getNormal()

public static XzArchiveSettings getNormal()

Gets the instance of the XzArchiveSettings class with dictionary size equals to 16 megabytes in LZMA2 filter, block size equals to 64 megabytes and CRC32 checksum.

Returns: XzArchiveSettings - the instance of the XzArchiveSettings class with normal parameters

setCompressionThreads(int value)

public final void setCompressionThreads(int value)

Sets compression thread count. If the value greater than 1, multithreading compression will be used.

Parameters:

ParameterTypeDescription
valueintcompression thread count.

Do not set this number more than CPU cores |