final class JarFileResourceLoader extends AbstractResourceLoader implements IterableResourceLoader
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
JarFileResourceLoader.CodeSigners |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<JarFileResourceLoader.CodeSigners,java.security.CodeSource> |
codeSources |
private static JarFileResourceLoader.CodeSigners |
EMPTY_CODE_SIGNERS |
private java.io.File |
fileOfJar |
private static java.lang.String |
INDEX_FILE |
private java.util.jar.JarFile |
jarFile |
private java.lang.String |
relativePath |
private java.lang.String |
rootName |
private java.net.URL |
rootUrl |
| Constructor and Description |
|---|
JarFileResourceLoader(java.lang.String rootName,
java.util.jar.JarFile jarFile) |
JarFileResourceLoader(java.lang.String rootName,
java.util.jar.JarFile jarFile,
java.lang.String relativePath) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
addInternalIndex(java.io.File file,
boolean modify) |
void |
close()
Closes this resource, relinquishing any underlying resources.
|
private java.security.CodeSource |
createCodeSource(java.util.jar.JarEntry entry) |
(package private) static void |
extractJarPaths(java.util.jar.JarFile jarFile,
java.lang.String relativePath,
java.util.Collection<java.lang.String> index) |
ClassSpec |
getClassSpec(java.lang.String fileName)
Get the class specification for the given class name.
|
private java.util.jar.JarEntry |
getJarEntry(java.lang.String fileName) |
private static java.net.URI |
getJarURI(java.net.URI original,
java.lang.String nestedPath) |
java.lang.String |
getLibrary(java.lang.String name)
Get the absolute physical filesystem path for a library with the given 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.
|
(package private) static java.util.Collection<java.lang.String> |
readIndex(java.io.InputStream stream,
java.util.Collection<java.lang.String> index,
java.lang.String relativePath) |
(package private) static void |
writeExternalIndex(java.io.File indexFile,
java.util.Collection<java.lang.String> index) |
getPackageSpecprivate static final java.lang.String INDEX_FILE
private final java.util.jar.JarFile jarFile
private final java.lang.String rootName
private final java.net.URL rootUrl
private final java.lang.String relativePath
private final java.io.File fileOfJar
private final java.util.Map<JarFileResourceLoader.CodeSigners,java.security.CodeSource> codeSources
private static final JarFileResourceLoader.CodeSigners EMPTY_CODE_SIGNERS
JarFileResourceLoader(java.lang.String rootName,
java.util.jar.JarFile jarFile)
JarFileResourceLoader(java.lang.String rootName,
java.util.jar.JarFile jarFile,
java.lang.String relativePath)
private static java.net.URI getJarURI(java.net.URI original,
java.lang.String nestedPath)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionpublic java.lang.String getRootName()
ResourceLoadergetRootName in interface ResourceLoadergetRootName in class AbstractResourceLoaderpublic ClassSpec getClassSpec(java.lang.String fileName) throws java.io.IOException
ResourceLoadernull is returned.getClassSpec in interface ResourceLoadergetClassSpec in class AbstractResourceLoaderfileName - the fileName of the class, e.g. for the class org.jboss.modules.ResourceLoader
the fileName will be org/jboss/modules/ResourceLoader.classnull if the named class is not foundjava.io.IOException - if an I/O error occursprivate java.security.CodeSource createCodeSource(java.util.jar.JarEntry entry)
private java.util.jar.JarEntry getJarEntry(java.lang.String fileName)
public PackageSpec getPackageSpec(java.lang.String name) throws java.io.IOException
ResourceLoader/" separators.getPackageSpec in interface ResourceLoadergetPackageSpec in class AbstractResourceLoadername - the directory namejava.io.IOException - if an I/O error occurspublic java.lang.String getLibrary(java.lang.String name)
ResourceLoader/" characters.getLibrary in interface ResourceLoadergetLibrary in class AbstractResourceLoadername - the namenull if the library is not presentpublic Resource getResource(java.lang.String name)
ResourceLoadernull is returned.
The resource name will always be specified using "/" separators for the directory segments.getResource in interface ResourceLoadergetResource in class AbstractResourceLoadername - 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 IterableResourceLoaderstartPath - 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 ResourceLoadergetPaths in class AbstractResourceLoaderpublic void close()
ResourceLoadertry-with-resources statement.close in interface java.lang.AutoCloseableclose in interface ResourceLoaderpublic java.net.URI getLocation()
ResourceLoadernull is returned.getLocation in interface ResourceLoadernull if not availablestatic void extractJarPaths(java.util.jar.JarFile jarFile,
java.lang.String relativePath,
java.util.Collection<java.lang.String> index)
static void writeExternalIndex(java.io.File indexFile,
java.util.Collection<java.lang.String> index)
static java.util.Collection<java.lang.String> readIndex(java.io.InputStream stream,
java.util.Collection<java.lang.String> index,
java.lang.String relativePath)
throws java.io.IOException
java.io.IOExceptionstatic void addInternalIndex(java.io.File file,
boolean modify)
throws java.io.IOException
java.io.IOException