convert a Class object to byte[] before redefine

84 Views Asked by At

I have Sample.class file and Sample Class object at runtime, Then I modify a method body in A.class and redefine it with redefineClasses. how can I get the byte array(in a class file format) that represents the original Sample Class object before redefine?
Getting the Sample.class file from file system is not an idea, because the Class object can be transformed by a java agent before it is defined, I need to get byte array from the Class object directly.

0

There are 0 best solutions below