XzArchiveSettings

Inheritance: java.lang.Object

public class XzArchiveSettings

The class contains a 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 megabytes, default block size equals to 64 megabytes, a 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:**
| Parameter | Type | Description |
| --- | --- | --- |
| filters | [XzFilterSettings\[\]](../../com.aspose.zip/xzfiltersettings) | filters (compressors) to be sequentially applied to create [XzArchive](../../com.aspose.zip/xzarchive). It can be either single [XzLZMA2FilterSettings](../../com.aspose.zip/xzlzma2filtersettings) or pair of [XzBcjX86FilterSettings](../../com.aspose.zip/xzbcjx86filtersettings) and [XzLZMA2FilterSettings](../../com.aspose.zip/xzlzma2filtersettings) |
| blockSize | long | size xz archive block |
| checkType | [XzCheckType](../../com.aspose.zip/xzchecktype) | type of checksum calculation for uncompressed data |

### getCompressionThreads() {#getCompressionThreads--}

public final int getCompressionThreads()



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

**Returns:**
int - compression thread count.
### getFastSpeed() {#getFastSpeed--}

public static XzArchiveSettings getFastSpeed()



Gets the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with dictionary size equals to 1 megabyte in LZMA2 filter, block size equals to 4 megabytes and CRC32 checksum.

**Returns:**
[XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) - the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with parameters for the fast speed
### getFastestSpeed() {#getFastestSpeed--}

public static XzArchiveSettings getFastestSpeed()



Gets the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with dictionary size equals to 65536 bytes in LZMA2 filter, block size equals to 1 megabyte and CRC32 checksum.

**Returns:**
[XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) - the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with parameters for the fastest speed
### getHighCompression() {#getHighCompression--}

public static XzArchiveSettings getHighCompression()



Gets the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with dictionary size equals to 32 megabytes in LZMA2 filter, block size equals to 128 megabytes and CRC32 checksum.

**Returns:**
[XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) - the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with parameters for the high compression
### getMaximumCompression() {#getMaximumCompression--}

public static XzArchiveSettings getMaximumCompression()



Gets the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with dictionary size equals to 64 megabytes in LZMA2 filter, block size equals to 256 megabytes and CRC32 checksum.

**Returns:**
[XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) - the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with parameters for the maximum compression
### getNormal() {#getNormal--}

public static XzArchiveSettings getNormal()



Gets the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with dictionary size equals to 16 megabytes in LZMA2 filter, block size equals to 64 megabytes and CRC32 checksum.

**Returns:**
[XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) - the instance of the [XzArchiveSettings](../../com.aspose.zip/xzarchivesettings) class with normal parameters
### setCompressionThreads(int value) {#setCompressionThreads-int-}

public final void setCompressionThreads(int value)



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

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | int | compression thread count.

Do not set this number more than CPU cores |