org.apache.commons.compress.archivers.sevenz

## 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 Summary

    Constructors
    Constructor and Description
    `Builder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SevenZFileOptions` | `build()` Create the `SevenZFileOptions`.
    `SevenZFileOptions.Builder` | `withMaxMemoryLimitInKb(int maxMemoryLimitInKb)` Sets the maximum amount of memory to use for parsing the archive and during extraction.
    `SevenZFileOptions.Builder` | `withTryToRecoverBrokenArchives(boolean tryToRecoverBrokenArchives)` Sets whether `SevenZFile` will try to revover broken archives where the CRC of the file's metadata is 0.
    `SevenZFileOptions.Builder` | `withUseDefaultNameForUnnamedEntries(boolean useDefaultNameForUnnamedEntries)` Sets whether entries without a name should get their names set to the archive's default file name.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder()

  - ### Method Detail

    - #### withMaxMemoryLimitInKb

          public SevenZFileOptions.Builder withMaxMemoryLimitInKb(int maxMemoryLimitInKb)

      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:
        `maxMemoryLimitInKb` - limit of the maximum amount of memory to use
      Returns:
        the reconfigured builder

    - #### 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

    - #### withTryToRecoverBrokenArchives

          public SevenZFileOptions.Builder withTryToRecoverBrokenArchives(boolean tryToRecoverBrokenArchives)

      Sets whether `SevenZFile` will try to revover 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

    - #### build

          public SevenZFileOptions build()

      Create the `SevenZFileOptions`.
      Returns:
        configured `SevenZFileOptions`.

Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.