java.lang.Object
io.smallrye.common.resource.JarFileResourceLoader
- All Implemented Interfaces:
ResourceLoader,Closeable,AutoCloseable
A resource loader which corresponds to a JAR file.
-
Field Summary
Fields inherited from interface io.smallrye.common.resource.ResourceLoader
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionJarFileResourceLoader(Resource resource) Construct a new instance from a JAR file contained within a resource.JarFileResourceLoader(Path jarPath) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbaseUrl()Returns the base URL for this loader.voidclose()Release any system resources or allocations associated with this resource loader.findResource(String path) Find a resource from this loader.manifest()Get the manifest for this resource loader, if any.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.smallrye.common.resource.ResourceLoader
getChildLoader, release
-
Constructor Details
-
JarFileResourceLoader
Construct a new instance.- Parameters:
jarPath- the path of the JAR file (must not benull)- Throws:
IOException- if opening the JAR file fails for some reason
-
JarFileResourceLoader
Construct a new instance from a JAR file contained within a resource.- Parameters:
resource- the resource of the JAR file (must not benull)- Throws:
IOException- if opening the JAR file fails for some reason
-
-
Method Details
-
findResource
Description copied from interface:ResourceLoaderFind a resource from this loader.- Specified by:
findResourcein interfaceResourceLoader- Parameters:
path- the resource path (must not benull)- Returns:
- the loaded resource, or
nullif no resource is found at the given path
-
baseUrl
Description copied from interface:ResourceLoaderReturns the base URL for this loader.- Specified by:
baseUrlin interfaceResourceLoader- Returns:
- the base URL for this loader
-
manifest
Description copied from interface:ResourceLoaderGet the manifest for this resource loader, if any. The default implementation constructs a new instance every time, so the caller should avoid repeated invocation of this method, caching as needed.- Specified by:
manifestin interfaceResourceLoader- Returns:
- the manifest, or
nullif no manifest was found - Throws:
IOException- if the manifest resource could not be loaded
-
close
public void close()Description copied from interface:ResourceLoaderRelease any system resources or allocations associated with this resource loader.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceResourceLoader
-