public class ClassUtils extends Object
Constructor and Description |
---|
ClassUtils() |
Modifier and Type | Method and Description |
---|---|
static Class<?> |
defineClass(Class<?> anchorClass,
String className,
byte[] classBytes)
Defines a new class from bytecode.
|
public static Class<?> defineClass(Class<?> anchorClass, String className, byte[] classBytes) throws ClassFormatError, IllegalAccessException
anchorClass
- the class from which the package and classloader of the new class are to be taken.className
- the name of the class to defineclassBytes
- the bytes used to define the classClassFormatError
- if the bytecode doesn't properly define a class.IllegalAccessException
- if unable to get access to the defineClassMethod.Copyright © 2024. All rights reserved.