Skip to content

Instantly share code, notes, and snippets.

@heipacker
Created April 9, 2016 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heipacker/dc219bff58e614a091cf0f989fe28d65 to your computer and use it in GitHub Desktop.
Save heipacker/dc219bff58e614a091cf0f989fe28d65 to your computer and use it in GitHub Desktop.
SimpleClassFileTransformer
package com.dlmu.agent.server;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;
/**
* Created by fupan on 16-4-9.
*/
public class SimpleClassFileTransformer implements ClassFileTransformer {
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
System.out.println("啊哈.");
return classfileBuffer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment