java.lang.instrument
public interface ClassFileTransformer
Modifier and Type | Method and Description |
---|---|
byte[] |
transform(ClassLoader loader,
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer)
Implementation of this method transforms a class by redefining its
bytecodes.
|
byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException
ClassLoader.defineClass
) or redefined
(Instrumentation.redefineClasses
)loader
- the loader of the classclassName
- the name of the class with packages separated with "/"classBeingRedefined
- the class being redefined if it's the case,
null otherwiseprotectionDomain
- the protection domain of the class being defined or
redefinedclassfileBuffer
- the input byte buffer in class file formatIllegalClassFormatException
- if the byte buffer does not represent
a well-formed class fileInstrumentation.redefineClasses(java.lang.instrument.ClassDefinition[])