final class FileResourceLoader extends NativeLibraryResourceLoader implements IterableResourceLoader
Modifier and Type | Class and Description |
---|---|
(package private) class |
FileResourceLoader.Itr |
NativeLibraryResourceLoader.Identification
Modifier and Type | Field and Description |
---|---|
private java.security.CodeSource |
codeSource |
private java.security.AccessControlContext |
context |
private java.util.jar.Manifest |
manifest |
private java.lang.String |
rootName |
Constructor and Description |
---|
FileResourceLoader(java.lang.String rootName,
java.io.File root,
java.security.AccessControlContext context) |
Modifier and Type | Method and Description |
---|---|
private void |
buildIndex(java.util.List<java.lang.String> index,
java.io.File root,
java.lang.String pathBase) |
private ClassSpec |
doGetClassSpec(java.lang.String fileName) |
ClassSpec |
getClassSpec(java.lang.String fileName)
Get the class specification for the given class name.
|
java.net.URI |
getLocation()
Get the base location of the resources in this loader (if any).
|
PackageSpec |
getPackageSpec(java.lang.String name)
Get the package specification for the given directory name.
|
java.util.Collection<java.lang.String> |
getPaths()
Get the collection of resource paths.
|
Resource |
getResource(java.lang.String name)
Get a resource with the given name.
|
java.lang.String |
getRootName()
Get the name of the root represented by this resource loader.
|
java.util.Iterator<Resource> |
iterateResources(java.lang.String startPath,
boolean recursive)
Enumerate all the resources under the given path.
|
private static java.util.jar.Manifest |
readManifestFile(java.io.File manifestFile) |
getArchName, getLibrary, getRoot
getPackageSpec
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getLibrary
private final java.lang.String rootName
private final java.util.jar.Manifest manifest
private final java.security.CodeSource codeSource
private final java.security.AccessControlContext context
FileResourceLoader(java.lang.String rootName, java.io.File root, java.security.AccessControlContext context)
private static java.util.jar.Manifest readManifestFile(java.io.File manifestFile)
public java.lang.String getRootName()
ResourceLoader
getRootName
in interface ResourceLoader
getRootName
in class AbstractResourceLoader
public ClassSpec getClassSpec(java.lang.String fileName) throws java.io.IOException
ResourceLoader
null
is returned.getClassSpec
in interface ResourceLoader
getClassSpec
in class AbstractResourceLoader
fileName
- the fileName of the class, e.g. for the class org.jboss.modules.ResourceLoader
the fileName will be org/jboss/modules/ResourceLoader.class
null
if the named class is not foundjava.io.IOException
- if an I/O error occursprivate ClassSpec doGetClassSpec(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public PackageSpec getPackageSpec(java.lang.String name) throws java.io.IOException
ResourceLoader
/
" separators.getPackageSpec
in interface ResourceLoader
getPackageSpec
in class AbstractResourceLoader
name
- the directory namejava.io.IOException
- if an I/O error occurspublic Resource getResource(java.lang.String name)
ResourceLoader
null
is returned.
The resource name will always be specified using "/
" separators for the directory segments.getResource
in interface ResourceLoader
getResource
in class AbstractResourceLoader
name
- the resource namenull
if it is not availablepublic java.util.Iterator<Resource> iterateResources(java.lang.String startPath, boolean recursive)
IterableResourceLoader
..
, such segments will be consumed.
If the path is absolute, it will be converted to a relative path by dropping the leading /
.iterateResources
in interface IterableResourceLoader
startPath
- the path to search underrecursive
- true
to recursively descend into subdirectories, false
to only read this pathpublic java.util.Collection<java.lang.String> getPaths()
ResourceLoader
/
" characters to separate the path segments.getPaths
in interface ResourceLoader
getPaths
in class AbstractResourceLoader
public java.net.URI getLocation()
ResourceLoader
null
is returned.getLocation
in interface ResourceLoader
getLocation
in class NativeLibraryResourceLoader
null
if not availableprivate void buildIndex(java.util.List<java.lang.String> index, java.io.File root, java.lang.String pathBase)