Class JarFSManager


  • public final class JarFSManager
    extends Object
    This component centralize the access to zip files Beware: All opened zip files are kept opened in memory
    • Method Detail

      • getFileSystemByResource

        public FileSystem getFileSystemByResource​(String resourcePath)
                                           throws IOException
        Return the jar filesystem associated with the given resource
        Parameters:
        resourcePath - The resource path to seek. Such as 'org/apache/ivy/logo.png'.
        Returns:
        The JAR filesystem or null if the resource cannot be found
        Throws:
        IOException - If an error occurred while getting the JAR file of an existing resource
      • getFileSystemByFile

        public FileSystem getFileSystemByFile​(File jarFile)
                                       throws IOException
        Return the jar filesystem associated with the given jar file
        Parameters:
        jarFile - the jar file to open
        Returns:
        The JAR filesystem or null if the file has a problem
        Throws:
        IOException - If an error occurred while opening the JAR file
      • getJARFileURI

        public String getJARFileURI​(String resourcePath)
                             throws IOException
        Determine the JAR file holding the given resource
        Parameters:
        resourcePath - The resource path to seek. Such as 'org/apache/ivy/logo.png'.
        Returns:
        The JAR file location. Such as '/path/to/jar/ivy.jar' or null if the resource cannot be found
        Throws:
        IOException - If an error occurred while getting the JAR file of an existing resource
      • getFileSystemByURI

        public FileSystem getFileSystemByURI​(String jarURI)
                                      throws IOException
        Return the jar filesystem associated with the given jar file denoted by its URI
        Parameters:
        jarURI - Such as "jar:file:/path/to/file.jar"
        Returns:
        The filesystem or null if the jarURI is null
        Throws:
        IOException - If the JAR file cannot be opened correctly