A
ClassFileTransformer
registered through an
Instrumentation object is offered a chance to
transform every class that is subsequently loaded or redefined. The
final argument to transform( ) is a byte array
that contains the raw bytes of the class file (or bytes returned by a
previously invoked ClassFileTransformer). If the
TRansform( )
method wishes to transform the class, it should return the
transformed bytes in a newly allocated array. The array passed to
transform( ) should not be modified. If the
transform( ) method does not wish to transform a
given class, it should return null.
public interface ClassFileTransformer {
// Public Instance Methods
byte[ ] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
java.security.ProtectionDomain protectionDomain, byte[ ] classfileBuffer)
throws IllegalClassFormatException;
}