Class ZipExtractor


  • public class ZipExtractor
    extends Object
    • Constructor Detail

      • ZipExtractor

        public ZipExtractor​(ZipReader zipReader)
    • Method Detail

      • extractDirectory

        public void extractDirectory​(@NotNull
                                     String zipPath,
                                     @NotNull
                                     File targetDirectory)
                              throws IOException
        Extract directory content from the ZIP archive.

        For example, if the archive contains

           a/b/c/1.txt
           a/b/c/2.txt
           3.txt
         
        and
            zipPath = "a/b/c"
            targetDirectory = "/tmp"
          
        then "/tmp/1.txt" and "/tmp/2.txt" will be created.

        If zipPath is empty then all files will be extracted.

        Files in targetDirectory with the name equal to the extracted file name will be overwritten, with the different name will not be modified.

        Also targetDirectory will be created if not exist.

        Throws:
        IOException