import com.xapi.bytecode.reader.*; import java.io.*; public class BytecodeReaderExample { public static void main(String[] args) { try { InputStream inputStream = new FileInputStream("MyClass.class"); BytecodeReader reader = new BytecodeReader(inputStream); ClassInfo classInfo = reader.readClass(); System.out.println("Class name: " + classInfo.getName()); System.out.println("Super class: " + classInfo.getSuperClass()); System.out.println("Interfaces: " + classInfo.getInterfaces()); for (FieldInfo field : classInfo.getFields()) { System.out.println("Field name: " + field.getName()); System.out.println("Field type: " + field.getType()); System.out.println("Field modifiers: " + field.getModifiers()); } for (MethodInfo method : classInfo.getMethods()) { System.out.println("Method name: " + method.getName()); System.out.println("Method parameters: " + method.getParameters()); System.out.println("Method return type: " + method.getReturnType()); System.out.println("Method modifiers: " + method.getModifiers()); } } catch (IOException e) { e.printStackTrace(); } } }


上一篇:
下一篇:
切换中文