getResourceAsStream() in java.lang.Class.
Try adding a ClassClassPath when a program is running
with a user-defined class loader and any class files are not found with
the default ClassPool. For example,
ClassPool cp = ClassPool.getDefault(); cp.insertClassPath(new ClassClassPath(this.getClass()));This code snippet permanently adds a
ClassClassPath
to the default ClassPool. Note that the default
ClassPool is a singleton. The added
ClassClassPath uses a class object representing
the class including the code snippet above.
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), LoaderClassPath
| Access | Constructor and Description |
|---|---|
| public | ClassClassPath(Class<?>
the c)Class object used to obtain a class
file. getResourceAsStream() is called on
this object.Creates a search path. |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public URL | Returns: null if the class file could not be found.a fully-qualified class name. classname)Implements javassist. Obtains the URL of the specified class file. |
| public InputStream | openClassfile(String
a fully-qualified class name classname)Implements javassist. Obtains a class file by |
| public String |
| thisClass | back to summary |
|---|---|
| private Class<?> thisClass | |
| ClassClassPath | back to summary |
|---|---|
| public ClassClassPath(Class<?> c) Creates a search path.
| |
| ClassClassPath | back to summary |
|---|---|
| pack-priv ClassClassPath() | |
| find | back to summary |
|---|---|
| public URL find(String classname) Implements javassist. Obtains the URL of the specified class file.
| |
| openClassfile | back to summary |
|---|---|
| public InputStream openClassfile(String classname) throws NotFoundException Implements javassist. Obtains a class file by
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |