public class LoaderClassPath extends 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(ClassLoader cl)
Creates a search path representing a class loader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this class path.
|
URL |
find(String classname)
Obtains the URL of the specified class file.
|
InputStream |
openClassfile(String classname)
Obtains a class file from the class loader.
|
String |
toString() |
public LoaderClassPath(ClassLoader cl)
public InputStream openClassfile(String classname)
getResourceAsStream(String)
on the class loader.openClassfile
in interface ClassPath
classname
- a fully-qualified class nameTranslator
public URL find(String classname)
getResource(String)
on the class loader.Copyright © 2019. All rights reserved.