public class LoaderClassPath extends java.lang.Object implements ClassPath
It is used for obtaining a class file from the given
class loader by getResourceAsStream()
.
The LoaderClassPath
refers to the class loader through
WeakReference
. If the class loader is garbage collected,
the other search pathes are examined.
The given class loader must have both getResourceAsStream()
and getResource()
.
ClassPool.insertClassPath(ClassPath)
,
ClassPool.appendClassPath(ClassPath)
,
ClassClassPath
Constructor and Description |
---|
LoaderClassPath(java.lang.ClassLoader cl)
Creates a search path representing a class loader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this class path.
|
java.net.URL |
find(java.lang.String classname)
Obtains the URL of the specified class file.
|
java.io.InputStream |
openClassfile(java.lang.String classname)
Obtains a class file from the class loader.
|
java.lang.String |
toString() |
public LoaderClassPath(java.lang.ClassLoader cl)
public java.lang.String toString()
toString
in class java.lang.Object
public java.io.InputStream openClassfile(java.lang.String classname)
getResourceAsStream(String)
on the class loader.openClassfile
in interface ClassPath
classname
- a fully-qualified class nameTranslator
public java.net.URL find(java.lang.String classname)
getResource(String)
on the class loader.Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.