Interface ResourceLoader
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
IterableResourceLoader
- All Known Implementing Classes:
AbstractResourceLoader, FileResourceLoader, FilteredIterableResourceLoader, FilteredResourceLoader, JarFileResourceLoader, NativeLibraryResourceLoader
A loader for resources from a specific resource root within a module.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Closes this resource, relinquishing any underlying resources.getClassSpec(String fileName) Get the class specification for the given class name.getLibrary(String name) Get the absolute physical filesystem path for a library with the given name.default URIGet the base location of the resources in this loader (if any).getPackageSpec(String name) Get the package specification for the given directory name.getPaths()Get the collection of resource paths.getResource(String name) Get a resource with the given name.Get the name of the root represented by this resource loader.
-
Method Details
-
getRootName
String getRootName()Get the name of the root represented by this resource loader.- Returns:
- the name of the root
-
getClassSpec
Get the class specification for the given class name. If no matching class is found,nullis returned.- Parameters:
fileName- the fileName of the class, e.g. for the classorg.jboss.modules.ResourceLoaderthe fileName will beorg/jboss/modules/ResourceLoader.class- Returns:
- the class specification, or
nullif the named class is not found - Throws:
IOException- if an I/O error occurs
-
getPackageSpec
Get the package specification for the given directory name. Always returns a package specification; this method cannot be used to test for the existence of a package. A package spec should always be acquired from the same resource loader which provided the class specification. The directory name will always be specified using "/" separators.- Parameters:
name- the directory name- Returns:
- the package specification
- Throws:
IOException- if an I/O error occurs
-
getResource
Get a resource with the given name. If no such resource is available,nullis returned. The resource name will always be specified using "/" separators for the directory segments.- Parameters:
name- the resource name- Returns:
- the resource, or
nullif it is not available
-
getLibrary
-
getPaths
Collection<String> getPaths()Get the collection of resource paths. Called one time only when the resource loader is initialized. The paths should use "/" characters to separate the path segments.- Returns:
- the resource paths
-
close
default void close()Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by thetry-with-resources statement.- Specified by:
closein interfaceAutoCloseable
-
getLocation
Get the base location of the resources in this loader (if any). If the location is not known, or the resource loader does not support locations, or the resource loader does not support this method,nullis returned.- Returns:
- the base location of the resources in this loader, or
nullif not available
-