Class SevenZFile.Builder
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<SevenZFile,SevenZFile.Builder>
org.apache.commons.io.build.AbstractOriginSupplier<SevenZFile,SevenZFile.Builder>
org.apache.commons.io.build.AbstractStreamBuilder<SevenZFile,SevenZFile.Builder>
org.apache.commons.compress.archivers.sevenz.SevenZFile.Builder
- All Implemented Interfaces:
org.apache.commons.io.function.IOSupplier<SevenZFile>
- Enclosing class:
SevenZFile
public static class SevenZFile.Builder
extends org.apache.commons.io.build.AbstractStreamBuilder<SevenZFile,SevenZFile.Builder>
Builds new instances of
SevenZFile.- Since:
- 1.26.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate int(package private) static final intprivate byte[]private SeekableByteChannel(package private) static final booleanprivate boolean(package private) static final booleanprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()setDefaultName(String defaultName) Sets the default name.setMaxMemoryLimitKb(int maxMemoryLimitKb) Sets the maximum amount of memory in kilobytes to use for parsing the archive and during extraction.setPassword(byte[] password) Sets the password.setPassword(char[] password) Sets the password.setPassword(String password) Sets the password.setSeekableByteChannel(SeekableByteChannel seekableByteChannel) Sets the input channel.setTryToRecoverBrokenArchives(boolean tryToRecoverBrokenArchives) Sets whetherSevenZFilewill try to recover broken archives where the CRC of the file's metadata is 0.setUseDefaultNameForUnnamedEntries(boolean useDefaultNameForUnnamedEntries) Sets whether entries without a name should get their names set to the archive's default file name.Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionsMethods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriterMethods inherited from class org.apache.commons.io.build.AbstractSupplier
asThisMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier
-
Field Details
-
MEMORY_LIMIT_IN_KB
static final int MEMORY_LIMIT_IN_KB- See Also:
-
USE_DEFAULTNAME_FOR_UNNAMED_ENTRIES
static final boolean USE_DEFAULTNAME_FOR_UNNAMED_ENTRIES- See Also:
-
TRY_TO_RECOVER_BROKEN_ARCHIVES
static final boolean TRY_TO_RECOVER_BROKEN_ARCHIVES- See Also:
-
seekableByteChannel
-
defaultName
-
password
private byte[] password -
maxMemoryLimitKb
private int maxMemoryLimitKb -
useDefaultNameForUnnamedEntries
private boolean useDefaultNameForUnnamedEntries -
tryToRecoverBrokenArchives
private boolean tryToRecoverBrokenArchives
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
get
- Throws:
IOException
-
setDefaultName
Sets the default name.- Parameters:
defaultName- the default name.- Returns:
thisinstance.
-
setMaxMemoryLimitKb
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
Sets the password.- Parameters:
password- the password.- Returns:
thisinstance.
-
setPassword
Sets the password.- Parameters:
password- the password.- Returns:
thisinstance.
-
setPassword
Sets the password.- Parameters:
password- the password.- Returns:
thisinstance.
-
setSeekableByteChannel
Sets the input channel.- Parameters:
seekableByteChannel- the input channel.- Returns:
thisinstance.
-
setTryToRecoverBrokenArchives
Sets whetherSevenZFilewill 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- whetherSevenZFilewill try to recover broken archives where the CRC of the file's metadata is 0.- Returns:
thisinstance.
-
setUseDefaultNameForUnnamedEntries
public SevenZFile.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.
-