Class ZipUtil.Unwrapper

  • All Implemented Interfaces:
    ZipEntryCallback
    Enclosing class:
    ZipUtil

    private static class ZipUtil.Unwrapper
    extends java.lang.Object
    implements ZipEntryCallback
    Unwraps entries excluding a single parent dir. If there are multiple roots ZipException is thrown.
    • Constructor Summary

      Constructors 
      Constructor Description
      Unwrapper​(java.io.File outputDir, NameMapper mapper)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String getRootName​(java.lang.String name)  
      private java.lang.String getUnrootedName​(java.lang.String root, java.lang.String name)  
      void process​(java.io.InputStream in, java.util.zip.ZipEntry zipEntry)
      Invoked for each entry in a ZIP file.
      • Methods inherited from class java.lang.Object

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

      • outputDir

        private final java.io.File outputDir
      • rootDir

        private java.lang.String rootDir
    • Constructor Detail

      • Unwrapper

        public Unwrapper​(java.io.File outputDir,
                         NameMapper mapper)
    • Method Detail

      • process

        public void process​(java.io.InputStream in,
                            java.util.zip.ZipEntry zipEntry)
                     throws java.io.IOException
        Description copied from interface: ZipEntryCallback
        Invoked for each entry in a ZIP file.
        Specified by:
        process in interface ZipEntryCallback
        Parameters:
        in - contents of the ZIP entry.
        zipEntry - ZIP entry.
        Throws:
        java.io.IOException - when any processing exception occurs
      • getUnrootedName

        private java.lang.String getUnrootedName​(java.lang.String root,
                                                 java.lang.String name)
      • getRootName

        private java.lang.String getRootName​(java.lang.String name)