ClassPathpublic 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().
Class files in a named module are private to that module. This method cannot obtain class files in named modules.
ClassPool.insertClassPath(ClassPath),
ClassPool.appendClassPath(ClassPath),
ClassClassPath| Constructor | Description |
|---|---|
LoaderClassPath(ClassLoader cl) |
Creates a search path representing a class loader.
|
| Modifier and Type | Method | Description |
|---|---|---|
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) throws NotFoundException
getResourceAsStream(String)
on the class loader.openClassfile in interface ClassPathclassname - a fully-qualified class nameNotFoundExceptionTranslatorCopyright © 2018 Shigeru Chiba, www.javassist.org. All rights reserved.