Class SevenZFileOptions.Builder

java.lang.Object
org.apache.commons.compress.archivers.sevenz.SevenZFileOptions.Builder
Enclosing class:
SevenZFileOptions

public static class SevenZFileOptions.Builder extends Object
Mutable builder for the immutable SevenZFileOptions.
Since:
1.19
  • Constructor Details

  • Method Details

    • build

      Builds the SevenZFileOptions.
      Returns:
      configured SevenZFileOptions.
    • withMaxMemoryLimitInKb

      public SevenZFileOptions.Builder withMaxMemoryLimitInKb(int maxMemoryLimitKb)
      Sets the maximum amount of memory to use for parsing the archive and during extraction.

      Not all codecs will honor this setting. Currently only LZMA and LZMA2 are supported.

      Parameters:
      maxMemoryLimitKb - limit of the maximum amount of memory to use
      Returns:
      the reconfigured builder
    • withTryToRecoverBrokenArchives

      public SevenZFileOptions.Builder withTryToRecoverBrokenArchives(boolean tryToRecoverBrokenArchives)
      Sets whether SevenZFile will try to recover broken archives where the CRC of the file's metadata is 0.

      This special kind of broken archive is encountered when mutli volume archives are closed prematurely. If you enable this option SevenZFile will trust data that looks as if it could contain metadata of an archive and allocate big amounts of memory. It is strongly recommended to not enable this option without setting withMaxMemoryLimitInKb(int) at the same time.

      Parameters:
      tryToRecoverBrokenArchives - if true SevenZFile will try to recover archives that are broken in the specific way
      Returns:
      the reconfigured builder
      Since:
      1.21
    • withUseDefaultNameForUnnamedEntries

      public SevenZFileOptions.Builder withUseDefaultNameForUnnamedEntries(boolean useDefaultNameForUnnamedEntries)
      Sets whether entries without a name should get their names set to the archive's default file name.
      Parameters:
      useDefaultNameForUnnamedEntries - if true the name of unnamed entries will be set to the archive's default name
      Returns:
      the reconfigured builder