Class XzArchiveSettings


  • public class XzArchiveSettings
    extends Object

    The class contains a set of setting particular xz archive.

    • Constructor Detail

      • 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

        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:
        filters - filters (compressors) to be sequentially applied to create XzArchive. It can be either single XzLZMA2FilterSettings or pair of XzBcjX86FilterSettings and XzLZMA2FilterSettings
        blockSize - size xz archive block
        checkType - type of checksum calculation for uncompressed data
        Throws:
        com.aspose.ms.System.ArgumentOutOfRangeException - blockSize is negative.
        com.aspose.ms.System.ArgumentNullException - filters is null
        com.aspose.ms.System.ArgumentException - filters has less than one or more than two filters, or last filter is not XzLZMA2FilterSettings.
    • 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 XzArchiveSettings class with dictionary size equals to 65536 bytes in LZMA2 filter, block size equals to 1 megabyte and CRC32 checksum.

        Returns:
        the instance of the XzArchiveSettings class with parameters for the fastest speed
      • 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:
        the instance of the XzArchiveSettings class with parameters for the fast speed
      • 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:
        the instance of the XzArchiveSettings class with normal parameters
      • 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:
        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:
        the instance of the XzArchiveSettings class with parameters for the maximum compression