Package org.ametys.core.util
Class JarFSManager
java.lang.Object
org.ametys.core.util.JarFSManager
This component centralize the access to zip files
Beware: All opened zip files are kept opened in memory
-
Method Summary
Modifier and TypeMethodDescriptiongetFileSystemByFile
(File jarFile) Return the jar filesystem associated with the given jar filegetFileSystemByResource
(String resourcePath) Return the jar filesystem associated with the given resourcegetFileSystemByURI
(String jarURI) Return the jar filesystem associated with the given jar file denoted by its URIstatic JarFSManager
Get the unique instancegetJARFileURI
(String resourcePath) Determine the JAR file holding the given resource
-
Method Details
-
getInstance
Get the unique instance- Returns:
- the unique instance
-
getFileSystemByResource
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
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
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
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
-