Class ZipUtils


  • public class ZipUtils
    extends Object
    Author:
    Alexey Loubyansky
    • Constructor Detail

      • ZipUtils

        public ZipUtils()
    • Method Detail

      • newFileSystem

        public static FileSystem newFileSystem​(URI uri,
                                               Map<String,​?> env)
                                        throws IOException
        This call is not thread safe, a single of FileSystem can be created for the profided uri until it is closed.
        Parameters:
        uri - The uri to the zip file.
        env - Env map.
        Returns:
        A new FileSystem.
        Throws:
        IOException - in case of a failure
      • newFileSystem

        public static FileSystem newFileSystem​(Path path)
                                        throws IOException
        This call is thread safe, a new FS is created for each invocation.
        Parameters:
        path - The zip file.
        Returns:
        A new FileSystem instance
        Throws:
        IOException - in case of a failure
      • wrapForJDK8232879

        public static OutputStream wrapForJDK8232879​(OutputStream original)
        This is a hack to get past the JDK-8232879 issue which causes CRC errors when writing out data to (jar) files using ZipFileSystem. TODO: Get rid of this method as soon as JDK-8232879 gets fixed and released in a public version
        Parameters:
        original - The original outputstream which will be wrapped into a new outputstream that delegates to this one.
        Returns: