Class SevenZFileOptions.Builder
- java.lang.Object
-
- org.apache.commons.compress.archivers.sevenz.SevenZFileOptions.Builder
-
- Enclosing class:
- SevenZFileOptions
public static class SevenZFileOptions.Builder extends java.lang.Object
Mutable builder for the immutableSevenZFileOptions
.- Since:
- 1.19
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SevenZFileOptions
build()
Create theSevenZFileOptions
.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 whetherSevenZFile
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.
-
-
-
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 whetherSevenZFile
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 theSevenZFileOptions
.- Returns:
- configured
SevenZFileOptions
.
-
-