Class Expander


  • public class Expander
    extends java.lang.Object
    Provides a high level API for expanding archives.
    Since:
    1.17
    • Constructor Summary

      Constructors 
      Constructor Description
      Expander()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void expand​(java.io.File archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(java.io.InputStream archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(java.lang.String format, java.io.File archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(java.lang.String format, java.io.InputStream archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(java.lang.String format, java.nio.channels.SeekableByteChannel archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(ArchiveInputStream archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(SevenZFile archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      void expand​(ZipFile archive, java.io.File targetDirectory)
      Expands archive into targetDirectory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • expand

        public void expand​(java.io.File archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.

        Tries to auto-detect the archive's format.

        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(java.lang.String format,
                           java.io.File archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.
        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        format - the archive format. This uses the same format as accepted by ArchiveStreamFactory.
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(java.io.InputStream archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.

        Tries to auto-detect the archive's format.

        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(java.lang.String format,
                           java.io.InputStream archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.
        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        format - the archive format. This uses the same format as accepted by ArchiveStreamFactory.
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(java.lang.String format,
                           java.nio.channels.SeekableByteChannel archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.
        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        format - the archive format. This uses the same format as accepted by ArchiveStreamFactory.
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(ArchiveInputStream archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.
        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(ZipFile archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.
        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons
      • expand

        public void expand​(SevenZFile archive,
                           java.io.File targetDirectory)
                    throws java.io.IOException,
                           ArchiveException
        Expands archive into targetDirectory.
        Parameters:
        archive - the file to expand
        targetDirectory - the directory to write to
        Throws:
        java.io.IOException - if an I/O error occurs
        ArchiveException - if the archive cannot be read for other reasons