Class SevenZipEntrySettings


  • public class SevenZipEntrySettings
    extends Object

    Settings used to compress or decompress 7z entries.

    • Method Detail

      • getCompressionSettings

        public final SevenZipCompressionSettings getCompressionSettings()

        Gets settings for compression or decompression routine.

        Returns:
        settings for compression or decompression routine
      • getEncryptionSettings

        public final SevenZipEncryptionSettings getEncryptionSettings()

        Gets settings for encryption or decryption. Settings of particular entry may vary.

        The SevenZipAESEncryptionSettings is only option for 7z archives.

        Returns:
        settings for encryption or decryption
      • getCompressHeader

        public final boolean getCompressHeader()

        Gets value indicating whether to compress archive header.

        This setting is equivalent -mhc=on switch of 7-Zip tool. Currently, it is incompatible with header encryption.

        Returns:
        value indicating whether to compress archive header
      • setCompressHeader

        public final void setCompressHeader​(boolean value)

        Sets value indicating whether to compress archive header.

        This setting is equivalent -mhc=on switch of 7-Zip tool. Currently, it is incompatible with header encryption.

        Parameters:
        value - a value indicating whether to compress archive header
      • getSolid

        public final boolean getSolid()

        Gets value indicating whether to concatenate entries and treat them as a single data block.

        The following example shows how to compress a directory to solid 7z archive with LZMA2 compression without encryption.

        
             try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
                 SevenZipEntrySettings settings = new SevenZipEntrySettings(new SevenZipLZMACompressionSettings());
                 settings.setSolid(true);
                 try (SevenZipArchive archive = new SevenZipArchive(settings)) {
                     archive.createEntries("C:\\Documents");
                     archive.save(sevenZipFile);
                 }
             } catch (IOException ex) {
             }
         

        Provide SevenZipEntrySettings for solid 7z archive on archive instantiation.

        Returns:
        value indicating whether to concatenate entries and treat them as a single data block.
      • setSolid

        public final void setSolid​(boolean value)

        Sets value indicating whether to concatenate entries and treat them as a single data block.

        The following example shows how to compress a directory to solid 7z archive with LZMA2 compression without encryption.

        
             try (FileOutputStream sevenZipFile = new FileOutputStream("archive.7z")) {
                 SevenZipEntrySettings settings = new SevenZipEntrySettings(new SevenZipLZMACompressionSettings());
                 settings.setSolid(true);
                 try (SevenZipArchive archive = new SevenZipArchive(settings)) {
                     archive.createEntries("C:\\Documents");
                     archive.save(sevenZipFile);
                 }
             } catch (IOException ex) {
             }
         

        Provide SevenZipEntrySettings for solid 7z archive on archive instantiation.

        Parameters:
        value - value indicating whether to concatenate entries and treat them as a single data block.