Class ClassDumper

java.lang.Object
aQute.libg.classdump.ClassDumper

public class ClassDumper extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • dump

      public void dump(PrintStream ps) throws Exception
      Throws:
      Exception
    • parseClassFile

      void parseClassFile(DataInputStream in) throws IOException
      Throws:
      IOException
    • doAttributes

      private void doAttributes(DataInputStream in, String indent) throws IOException
      Called for each attribute in the class, field, or method.
      Parameters:
      in - The stream
      Throws:
      IOException
    • doAttribute

      private void doAttribute(DataInputStream in, String indent) throws IOException
      Process a single attribute, if not recognized, skip it.
      Parameters:
      in - the data stream
      Throws:
      IOException
    • doSignature

      void doSignature(DataInputStream in, String indent) throws IOException
        Signature_attribute { u2 attribute_name_index; u4 attribute_length;
       u2 signature_index; }
       
      Parameters:
      in -
      indent -
      Throws:
      IOException
    • doEnclosingMethod

      void doEnclosingMethod(DataInputStream in, String indent) throws IOException
        EnclosingMethod_attribute { u2 attribute_name_index; u4
       attribute_length; u2 class_index u2 method_index; }
       
      Throws:
      IOException
    • doExceptions

      private void doExceptions(DataInputStream in, String indent) throws IOException
        Exceptions_attribute { u2 attribute_name_index; u4
       attribute_length; u2 number_of_exceptions; u2
       exception_index_table[number_of_exceptions]; }
       
      Parameters:
      in -
      indent -
      Throws:
      IOException
    • doCode

      private void doCode(DataInputStream in, String indent) throws IOException
        Code_attribute { u2 attribute_name_index; u4 attribute_length; u2
       max_stack; u2 max_locals; u4 code_length; u1 code[code_length]; u2
       exception_table_length; { u2 start_pc; u2 end_pc; u2 handler_pc; u2
       catch_type; } exception_table[exception_table_length]; u2
       attributes_count; attribute_info attributes[attributes_count]; }
       
      Throws:
      IOException
    • printHex

      protected void printHex(byte[] code)
      We must find Class.forName references ...
      Parameters:
      code -
    • doSourceFile

      private void doSourceFile(DataInputStream in, String indent) throws IOException
      Throws:
      IOException
    • doAnnotations

      private void doAnnotations(DataInputStream in, String indent) throws IOException
      Throws:
      IOException
    • doAnnotation

      private void doAnnotation(DataInputStream in, String indent) throws IOException
      Throws:
      IOException
    • doElementValue

      private void doElementValue(DataInputStream in, String indent) throws IOException
      Throws:
      IOException
    • doLineNumberTable

      void doLineNumberTable(DataInputStream in, String indent) throws IOException
        LineNumberTable_attribute { u2 attribute_name_index; u4
       attribute_length; u2 line_number_table_length; { u2 start_pc; u2
       line_number; } line_number_table[line_number_table_length]; }
       
      Throws:
      IOException
    • doLocalVariableTable

      void doLocalVariableTable(DataInputStream in, String indent) throws IOException
        LocalVariableTable_attribute { u2 attribute_name_index; u4
       attribute_length; u2 local_variable_table_length; { u2 start_pc; u2
       length; u2 name_index; u2 descriptor_index; u2 index; }
       local_variable_table[local_variable_table_length]; }
       
      Throws:
      IOException
    • doInnerClasses

      void doInnerClasses(DataInputStream in, String indent) throws IOException
        InnerClasses_attribute { u2 attribute_name_index; u4
       attribute_length; u2 number_of_classes; { u2 inner_class_info_index; u2
       outer_class_info_index; u2 inner_name_index; u2 inner_class_access_flags;
       } classes[number_of_classes]; }
       
      Throws:
      IOException
    • printClassAccess

      void printClassAccess(int mod)
    • printAccess

      void printAccess(int mod)
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception