Class ByteCodeWriter


  • public class ByteCodeWriter
    extends java.lang.Object
    Example: // Byte code: // 0: aconst_null // 1: astore_2 // 2: aconst_null // 3: astore_3 // 4: aload_0 // 5: aload_1 // 6: invokeinterface 142 2 0 // 11: astore_2 // 12: aload_2 // 13: ifnull +49 -> 62 // 16: aload_2 // 17: invokestatic 146 jd/core/process/deserializer/ClassFileDeserializer:Deserialize (Ljava/io/DataInput;)Ljd/core/model/classfile/ClassFile; // 20: astore_3 // 21: goto +41 -> 62 // 24: astore 4 // 26: aconst_null // 27: astore_3 // 28: aload_2 // 29: ifnull +46 -> 75 // 32: aload_2 // 33: invokevirtual 149 java/io/DataInputStream:close ()V // 36: goto +39 -> 75 // 39: astore 6 // 41: goto +34 -> 75 // 44: astore 5 // 46: aload_2 // 47: ifnull +12 -> 59 // 50: aload_2 // 51: invokevirtual 149 java/io/DataInputStream:close ()V // 54: goto +5 -> 59 // 57: astore 6 // 59: aload 5 // 61: athrow // 62: aload_2 // 63: ifnull +12 -> 75 // 66: aload_2 // 67: invokevirtual 149 java/io/DataInputStream:close ()V // 70: goto +5 -> 75 // 73: astore 6 // 75: aload_3 // 76: areturn // Line number table: // #Java source line -> byte code offset // #112 -> 0 // #113 -> 2 // #117 -> 4 // #118 -> 12 // #119 -> 16 // #120 -> 21 // #121 -> 24 // #123 -> 26 // #128 -> 28 // #129 -> 32 // #127 -> 44 // #128 -> 46 // #129 -> 50 // #130 -> 59 // #128 -> 62 // #129 -> 66 // #132 -> 75 // Local variable table: // start length slot name signature // 0 77 0 loader Loader // 0 77 1 internalClassPath String // 1 66 2 dis java.io.DataInputStream // 3 73 3 classFile ClassFile // 24 3 4 e IOException // 44 16 5 localObject Object // 39 1 6 localIOException1 IOException // 57 1 6 localIOException2 IOException // 73 1 6 localIOException3 IOException // Exception table: // from to target type // 4 21 24 java/io/IOException // 32 36 39 java/io/IOException // 4 28 44 finally // 50 54 57 java/io/IOException // 66 70 73 java/io/IOException
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String[] OPCODE_NAMES  
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteCodeWriter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String write​(java.lang.String linePrefix, Method method)  
      static java.lang.String write​(java.lang.String linePrefix, Method method, int fromOffset, int toOffset)  
      protected static void writeByteCode​(java.lang.String linePrefix, java.lang.StringBuilder sb, ConstantPool constants, byte[] code, int fromOffset, int toOffset)  
      protected static void writeByteCode​(java.lang.String linePrefix, java.lang.StringBuilder sb, ConstantPool constants, AttributeCode attributeCode)  
      protected static void writeExceptionTable​(java.lang.String linePrefix, java.lang.StringBuilder sb, ConstantPool constants, AttributeCode attributeCode)  
      protected static void writeLDC​(java.lang.StringBuilder sb, ConstantPool constants, Constant constant)  
      protected static void writeLineNumberTable​(java.lang.String linePrefix, java.lang.StringBuilder sb, AttributeCode attributeCode)  
      protected static void writeLocalVariableTable​(java.lang.String linePrefix, java.lang.StringBuilder sb, AttributeCode attributeCode)  
      • Methods inherited from class java.lang.Object

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

      • OPCODE_NAMES

        protected static final java.lang.String[] OPCODE_NAMES
    • Constructor Detail

      • ByteCodeWriter

        public ByteCodeWriter()
    • Method Detail

      • write

        public static java.lang.String write​(java.lang.String linePrefix,
                                             Method method)
      • write

        public static java.lang.String write​(java.lang.String linePrefix,
                                             Method method,
                                             int fromOffset,
                                             int toOffset)
      • writeByteCode

        protected static void writeByteCode​(java.lang.String linePrefix,
                                            java.lang.StringBuilder sb,
                                            ConstantPool constants,
                                            AttributeCode attributeCode)
      • writeByteCode

        protected static void writeByteCode​(java.lang.String linePrefix,
                                            java.lang.StringBuilder sb,
                                            ConstantPool constants,
                                            byte[] code,
                                            int fromOffset,
                                            int toOffset)
      • writeLDC

        protected static void writeLDC​(java.lang.StringBuilder sb,
                                       ConstantPool constants,
                                       Constant constant)
      • writeLineNumberTable

        protected static void writeLineNumberTable​(java.lang.String linePrefix,
                                                   java.lang.StringBuilder sb,
                                                   AttributeCode attributeCode)
      • writeLocalVariableTable

        protected static void writeLocalVariableTable​(java.lang.String linePrefix,
                                                      java.lang.StringBuilder sb,
                                                      AttributeCode attributeCode)
      • writeExceptionTable

        protected static void writeExceptionTable​(java.lang.String linePrefix,
                                                  java.lang.StringBuilder sb,
                                                  ConstantPool constants,
                                                  AttributeCode attributeCode)