abstract static class ClassPath.Scanner
extends java.lang.Object
ClassLoader
and calls
scanDirectory(java.lang.ClassLoader, java.io.File)
and scanJarFile(java.lang.ClassLoader, java.util.jar.JarFile)
for directories and jar files on the class path
respectively.Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.io.File> |
scannedUris |
Constructor and Description |
---|
Scanner() |
Modifier and Type | Method and Description |
---|---|
private static ImmutableList<java.net.URL> |
getClassLoaderUrls(java.lang.ClassLoader classloader) |
(package private) static ImmutableMap<java.io.File,java.lang.ClassLoader> |
getClassPathEntries(java.lang.ClassLoader classloader) |
(package private) static java.net.URL |
getClassPathEntry(java.io.File jarFile,
java.lang.String path)
Returns the absolute uri of the Class-Path entry value as specified in JAR
File Specification.
|
(package private) static ImmutableSet<java.io.File> |
getClassPathFromManifest(java.io.File jarFile,
java.util.jar.Manifest manifest)
Returns the class path URIs specified by the
Class-Path manifest attribute, according
to JAR
File Specification. |
(package private) static ImmutableList<java.net.URL> |
parseJavaClassPath()
Returns the URLs in the class path specified by the
java.class.path system property. |
void |
scan(java.lang.ClassLoader classloader) |
(package private) void |
scan(java.io.File file,
java.lang.ClassLoader classloader) |
protected abstract void |
scanDirectory(java.lang.ClassLoader loader,
java.io.File directory)
Called when a directory is scanned for resource files.
|
private void |
scanFrom(java.io.File file,
java.lang.ClassLoader classloader) |
private void |
scanJar(java.io.File file,
java.lang.ClassLoader classloader) |
protected abstract void |
scanJarFile(java.lang.ClassLoader loader,
java.util.jar.JarFile file)
Called when a jar file is scanned for resource entries.
|
public final void scan(java.lang.ClassLoader classloader) throws java.io.IOException
java.io.IOException
final void scan(java.io.File file, java.lang.ClassLoader classloader) throws java.io.IOException
java.io.IOException
protected abstract void scanDirectory(java.lang.ClassLoader loader, java.io.File directory) throws java.io.IOException
java.io.IOException
protected abstract void scanJarFile(java.lang.ClassLoader loader, java.util.jar.JarFile file) throws java.io.IOException
java.io.IOException
private void scanFrom(java.io.File file, java.lang.ClassLoader classloader) throws java.io.IOException
java.io.IOException
private void scanJar(java.io.File file, java.lang.ClassLoader classloader) throws java.io.IOException
java.io.IOException
static ImmutableSet<java.io.File> getClassPathFromManifest(java.io.File jarFile, java.util.jar.Manifest manifest)
Class-Path
manifest attribute, according
to JAR
File Specification. If manifest
is null, it means the jar file has no manifest,
and an empty set will be returned.static ImmutableMap<java.io.File,java.lang.ClassLoader> getClassPathEntries(java.lang.ClassLoader classloader)
private static ImmutableList<java.net.URL> getClassLoaderUrls(java.lang.ClassLoader classloader)
static ImmutableList<java.net.URL> parseJavaClassPath()
java.class.path
system property.static java.net.URL getClassPathEntry(java.io.File jarFile, java.lang.String path) throws java.net.MalformedURLException
java.net.MalformedURLException