private class SecurityManager.HookClassLoader
extends java.lang.ClassLoader
ClassLoader
to enable the loading of
a class file stored as a byte array in memory.Modifier and Type | Field and Description |
---|---|
private java.lang.Class<?> |
cls
The class defined by the bytecode; will be loaded on the first
findClass(java.lang.String)
call. |
private byte[] |
data
Byte array to load the class from
|
Modifier | Constructor and Description |
---|---|
private |
HookClassLoader(java.lang.ClassLoader parent,
byte[] source)
Constructor for a single source.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Class<?> |
findClass(java.lang.String name)
Find and load the class with the given name.
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
private byte[] data
private java.lang.Class<?> cls
findClass(java.lang.String)
call.private HookClassLoader(java.lang.ClassLoader parent, byte[] source)
parent
- The parent ClassLoader
.source
- array of bytes this class loader operatesprotected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException
If the hook class name matches the received name, return the hook class
.
Else, let the parent class loader resolve it.
findClass
in class java.lang.ClassLoader
Class
object.java.lang.ClassNotFoundException
- If the class can not be found or class linkage has error
occurred.