Class BytecodePrinter


  • public class BytecodePrinter
    extends java.lang.Object
    A collection of static methods for debugging by printing the ASM bytecode. These methods are only for debug, so most of the time they should stay unused.
    • Constructor Summary

      Constructors 
      Constructor Description
      BytecodePrinter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String insnToString​(org.objectweb.asm.tree.AbstractInsnNode insn)
      Converts an instruction node to a String.
      static void logMethod​(org.objectweb.asm.tree.MethodNode main, java.lang.String path)
      Logs the bytecode of a method to a file.
      static void logMethod​(org.objectweb.asm.tree.MethodNode main, org.apache.logging.log4j.Logger logger)
      Logs the bytecode of a method using the ASM logger.
      static void printMethod​(org.objectweb.asm.tree.MethodNode main)
      Prints the bytecode of a method using System.out.print().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BytecodePrinter

        public BytecodePrinter()
    • Method Detail

      • printMethod

        public static void printMethod​(org.objectweb.asm.tree.MethodNode main)
        Prints the bytecode of a method using System.out.print().
        Parameters:
        main - the method to print
      • logMethod

        public static void logMethod​(org.objectweb.asm.tree.MethodNode main,
                                     org.apache.logging.log4j.Logger logger)
        Logs the bytecode of a method using the ASM logger.
        Parameters:
        main - the method to print
        logger - the Log4j Logger to print it with
      • logMethod

        public static void logMethod​(org.objectweb.asm.tree.MethodNode main,
                                     java.lang.String path)
        Logs the bytecode of a method to a file.
        Parameters:
        main - the method to print
        path - the file to log it to
      • insnToString

        public static java.lang.String insnToString​(org.objectweb.asm.tree.AbstractInsnNode insn)
        Converts an instruction node to a String.
        Parameters:
        insn - the node to convert
        Returns:
        the converted string