Package kala.compress.archivers.sevenz
Class SevenZArchiveReader.Builder
- java.lang.Object
-
- kala.compress.archivers.ArchiveReaderBuilder<SevenZArchiveReader,SevenZArchiveReader.Builder>
-
- kala.compress.archivers.sevenz.SevenZArchiveReader.Builder
-
- Enclosing class:
- SevenZArchiveReader
public static class SevenZArchiveReader.Builder extends ArchiveReaderBuilder<SevenZArchiveReader,SevenZArchiveReader.Builder>
Builds new instances ofSevenZArchiveReader.- Since:
- 1.26.0
-
-
Field Summary
Fields Modifier and Type Field Description private intmaxMemoryLimitKbprivate byte[]passwordprivate booleantryToRecoverBrokenArchivesprivate booleanuseDefaultNameForUnnamedEntries-
Fields inherited from class kala.compress.archivers.ArchiveReaderBuilder
charset, DEFAULT_OPEN_OPTIONS, openOptions, originDescription, path, seekableByteChannel
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SevenZArchiveReaderget()Gets the archive reader.SevenZArchiveReader.BuildersetDefaultName(java.lang.String defaultName)Sets the default name.SevenZArchiveReader.BuildersetMaxMemoryLimitKb(int maxMemoryLimitKb)Sets the maximum amount of memory in kilobytes to use for parsing the archive and during extraction.SevenZArchiveReader.BuildersetPassword(byte[] password)Sets the password.SevenZArchiveReader.BuildersetPassword(char[] password)Sets the password.SevenZArchiveReader.BuildersetPassword(java.lang.String password)Sets the password.SevenZArchiveReader.BuildersetTryToRecoverBrokenArchives(boolean tryToRecoverBrokenArchives)Sets whetherSevenZArchiveReaderwill try to recover broken archives where the CRC of the file's metadata is 0.SevenZArchiveReader.BuildersetUseDefaultNameForUnnamedEntries(boolean useDefaultNameForUnnamedEntries)Sets whether entries without a name should get their names set to the archive's default file name.-
Methods inherited from class kala.compress.archivers.ArchiveReaderBuilder
asThis, checkPath, setByteArray, setCharset, setCharset, setFile, setFile, setOpenOptions, setOriginDescription, setPath, setPath, setSeekableByteChannel, setURI
-
-
-
-
Method Detail
-
get
public SevenZArchiveReader get() throws java.io.IOException
Description copied from class:ArchiveReaderBuilderGets the archive reader.- Specified by:
getin classArchiveReaderBuilder<SevenZArchiveReader,SevenZArchiveReader.Builder>- Returns:
- a result.
- Throws:
java.io.IOException- if an I/O error occurs.
-
setDefaultName
public SevenZArchiveReader.Builder setDefaultName(java.lang.String defaultName)
Sets the default name.- Parameters:
defaultName- the default name.- Returns:
thisinstance.- See Also:
ArchiveReaderBuilder.setOriginDescription(String)
-
setMaxMemoryLimitKb
public SevenZArchiveReader.Builder setMaxMemoryLimitKb(int maxMemoryLimitKb)
Sets the maximum amount of memory in kilobytes to use for parsing the archive and during extraction.Not all codecs honor this setting. Currently only LZMA and LZMA2 are supported.
- Parameters:
maxMemoryLimitKb- the max memory limit in kilobytes.- Returns:
thisinstance.
-
setPassword
public SevenZArchiveReader.Builder setPassword(byte[] password)
Sets the password.- Parameters:
password- the password.- Returns:
thisinstance.
-
setPassword
public SevenZArchiveReader.Builder setPassword(char[] password)
Sets the password.- Parameters:
password- the password.- Returns:
thisinstance.
-
setPassword
public SevenZArchiveReader.Builder setPassword(java.lang.String password)
Sets the password.- Parameters:
password- the password.- Returns:
thisinstance.
-
setTryToRecoverBrokenArchives
public SevenZArchiveReader.Builder setTryToRecoverBrokenArchives(boolean tryToRecoverBrokenArchives)
Sets whetherSevenZArchiveReaderwill 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
setMaxMemoryLimitKb(int)at the same time.- Parameters:
tryToRecoverBrokenArchives- whetherSevenZArchiveReaderwill try to recover broken archives where the CRC of the file's metadata is 0.- Returns:
thisinstance.
-
setUseDefaultNameForUnnamedEntries
public SevenZArchiveReader.Builder setUseDefaultNameForUnnamedEntries(boolean useDefaultNameForUnnamedEntries)
Sets whether entries without a name should get their names set to the archive's default file name.- Parameters:
useDefaultNameForUnnamedEntries- whether entries without a name should get their names set to the archive's default file name.- Returns:
thisinstance.
-
-