Class XzArchiveSettings
- java.lang.Object
-
- com.aspose.zip.XzArchiveSettings
-
public class XzArchiveSettings extends Object
The class contains a set of setting particular xz archive.
-
-
Constructor Summary
Constructors Constructor Description XzArchiveSettings()Initializes a new instance of theXzArchiveSettingsclass using single LZMA2 compression.XzArchiveSettings(XzFilterSettings[] filters, long blockSize, XzCheckType checkType)Initializes a new instance of theXzArchiveSettingsclass with custom parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCompressionThreads()Gets compression thread count.static XzArchiveSettingsgetFastestSpeed()Gets the instance of theXzArchiveSettingsclass with dictionary size equals to 65536 bytes in LZMA2 filter, block size equals to 1 megabyte and CRC32 checksum.static XzArchiveSettingsgetFastSpeed()Gets the instance of theXzArchiveSettingsclass with dictionary size equals to 1 megabyte in LZMA2 filter, block size equals to 4 megabytes and CRC32 checksum.static XzArchiveSettingsgetHighCompression()Gets the instance of theXzArchiveSettingsclass with dictionary size equals to 32 megabytes in LZMA2 filter, block size equals to 128 megabytes and CRC32 checksum.static XzArchiveSettingsgetMaximumCompression()Gets the instance of theXzArchiveSettingsclass with dictionary size equals to 64 megabytes in LZMA2 filter, block size equals to 256 megabytes and CRC32 checksum.static XzArchiveSettingsgetNormal()Gets the instance of theXzArchiveSettingsclass with dictionary size equals to 16 megabytes in LZMA2 filter, block size equals to 64 megabytes and CRC32 checksum.voidsetCompressionThreads(int value)Sets compression thread count.
-
-
-
Constructor Detail
-
XzArchiveSettings
public XzArchiveSettings()
Initializes a new instance of the
XzArchiveSettingsclass 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
public XzArchiveSettings(XzFilterSettings[] filters, long blockSize, XzCheckType checkType)
Initializes a new instance of the
XzArchiveSettingsclass 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:
filters- filters (compressors) to be sequentially applied to createXzArchive. It can be either singleXzLZMA2FilterSettingsor pair ofXzBcjX86FilterSettingsandXzLZMA2FilterSettingsblockSize- size xz archive blockcheckType- type of checksum calculation for uncompressed data- Throws:
com.aspose.ms.System.ArgumentOutOfRangeException-blockSizeis negative.com.aspose.ms.System.ArgumentNullException-filtersis nullcom.aspose.ms.System.ArgumentException-filtershas less than one or more than two filters, or last filter is notXzLZMA2FilterSettings.
-
-
Method Detail
-
getCompressionThreads
public final int getCompressionThreads()
Gets compression thread count. If the value is greater than 1, multithreading compression will be used.
- Returns:
- compression thread count
- Throws:
com.aspose.ms.System.ArgumentOutOfRangeException- The number of threads is more than 100.
-
setCompressionThreads
public final void setCompressionThreads(int value)
Sets compression thread count. If the value is greater than 1, multithreading compression will be used.
- Parameters:
value- compression thread count.Do not set this number more than CPU cores
- Throws:
com.aspose.ms.System.ArgumentOutOfRangeException- The number of threads is more than 100.
-
getFastestSpeed
public static XzArchiveSettings getFastestSpeed()
Gets the instance of the
XzArchiveSettingsclass with dictionary size equals to 65536 bytes in LZMA2 filter, block size equals to 1 megabyte and CRC32 checksum.- Returns:
- the instance of the
XzArchiveSettingsclass with parameters for the fastest speed
-
getFastSpeed
public static XzArchiveSettings getFastSpeed()
Gets the instance of the
XzArchiveSettingsclass with dictionary size equals to 1 megabyte in LZMA2 filter, block size equals to 4 megabytes and CRC32 checksum.- Returns:
- the instance of the
XzArchiveSettingsclass with parameters for the fast speed
-
getNormal
public static XzArchiveSettings getNormal()
Gets the instance of the
XzArchiveSettingsclass with dictionary size equals to 16 megabytes in LZMA2 filter, block size equals to 64 megabytes and CRC32 checksum.- Returns:
- the instance of the
XzArchiveSettingsclass with normal parameters
-
getHighCompression
public static XzArchiveSettings getHighCompression()
Gets the instance of the
XzArchiveSettingsclass with dictionary size equals to 32 megabytes in LZMA2 filter, block size equals to 128 megabytes and CRC32 checksum.- Returns:
- the instance of the
XzArchiveSettingsclass with parameters for the high compression
-
getMaximumCompression
public static XzArchiveSettings getMaximumCompression()
Gets the instance of the
XzArchiveSettingsclass with dictionary size equals to 64 megabytes in LZMA2 filter, block size equals to 256 megabytes and CRC32 checksum.- Returns:
- the instance of the
XzArchiveSettingsclass with parameters for the maximum compression
-
-