Class SevenZFile.Builder

    • Constructor Summary

      Constructors 
      Constructor Description
      Builder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SevenZFile get()  
      SevenZFile.Builder setDefaultName​(java.lang.String defaultName)
      Sets the default name.
      SevenZFile.Builder setMaxMemoryLimitKb​(int maxMemoryLimitKb)
      Sets the maximum amount of memory in kilobytes to use for parsing the archive and during extraction.
      SevenZFile.Builder setPassword​(byte[] password)
      Sets the password.
      SevenZFile.Builder setPassword​(char[] password)
      Sets the password.
      SevenZFile.Builder setPassword​(java.lang.String password)
      Sets the password.
      SevenZFile.Builder setSeekableByteChannel​(java.nio.channels.SeekableByteChannel seekableByteChannel)
      Sets the input channel.
      SevenZFile.Builder setTryToRecoverBrokenArchives​(boolean tryToRecoverBrokenArchives)
      Sets whether SevenZFile will try to recover broken archives where the CRC of the file's metadata is 0.
      SevenZFile.Builder 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, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptions
      • Methods 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, setWriter
      • Methods inherited from class org.apache.commons.io.build.AbstractSupplier

        asThis
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.commons.io.function.IOSupplier

        asSupplier
    • Constructor Detail

    • Method Detail

      • get

        public SevenZFile get()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • setDefaultName

        public SevenZFile.Builder setDefaultName​(java.lang.String defaultName)
        Sets the default name.
        Parameters:
        defaultName - the default name.
        Returns:
        this.
      • setMaxMemoryLimitKb

        public SevenZFile.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:
        this.
      • setPassword

        public SevenZFile.Builder setPassword​(byte[] password)
        Sets the password.
        Parameters:
        password - the password.
        Returns:
        this.
      • setPassword

        public SevenZFile.Builder setPassword​(char[] password)
        Sets the password.
        Parameters:
        password - the password.
        Returns:
        this.
      • setPassword

        public SevenZFile.Builder setPassword​(java.lang.String password)
        Sets the password.
        Parameters:
        password - the password.
        Returns:
        this.
      • setSeekableByteChannel

        public SevenZFile.Builder setSeekableByteChannel​(java.nio.channels.SeekableByteChannel seekableByteChannel)
        Sets the input channel.
        Parameters:
        seekableByteChannel - the input channel.
        Returns:
        this.
      • setTryToRecoverBrokenArchives

        public SevenZFile.Builder setTryToRecoverBrokenArchives​(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 setMaxMemoryLimitKb(int) at the same time.

        Parameters:
        tryToRecoverBrokenArchives - whether SevenZFile will try to recover broken archives where the CRC of the file's metadata is 0.
        Returns:
        this.
      • 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:
        this.