Class ClassData

All Implemented Interfaces:
Printable

public class ClassData extends MemberData<ClassData>
Central class data for of the Java Disassembler
  • Field Details

    • cfVersion

      protected CFVersion cfVersion
    • this_cpx

      protected int this_cpx
    • className

      protected String className
    • packageName

      protected String packageName
    • classShortName

      protected String classShortName
    • super_cpx

      protected int super_cpx
    • interfaces

      protected int[] interfaces
    • fields

      protected Container<FieldData> fields
    • methods

      protected Container<MethodData> methods
    • sourceFileData

      protected SourceFileData sourceFileData
      Attributes: SourceFile 45.3 InnerClasses 45.3 EnclosingMethod 49.0 SourceDebugExtension 49.0 BootstrapMethods 51.0 Module, ModulePackages, ModuleMainClass 53.0 NestHost, NestMembers 55.0 Record 60.0 PermittedSubclasses 61.0 ------------------------------------------------- Synthetic 45.3 Deprecated 45.3 Signature 49.0 RuntimeVisibleAnnotations 49.0 RuntimeInvisibleAnnotations 49.0 RuntimeVisibleTypeAnnotations 52.0 RuntimeInvisibleTypeAnnotations 52.0
    • innerClasses

      protected Container<InnerClassData> innerClasses
    • recordData

      protected RecordData recordData
    • bootstrapMethods

      protected Container<BootstrapMethodData> bootstrapMethods
    • moduleData

      protected ModuleData moduleData
    • nestHost

      protected NestHostData nestHost
    • nestMembers

      protected NestMembersData nestMembers
    • permittedSubclassesData

      protected PermittedSubclassesData permittedSubclassesData
    • sourceDebugExtensionData

      protected SourceDebugExtensionData sourceDebugExtensionData
    • preloadData

      protected PreloadData preloadData
    • sourceLines

      private TextLines sourceLines
    • classFile

      private Path classFile
  • Constructor Details

  • Method Details

    • read

      public void read(File inputFile) throws IOException
      Throws:
      IOException
    • read

      public void read(String inputFileName) throws IOException
      Throws:
      IOException
    • readFields

      protected void readFields(DataInputStream in) throws IOException
      Read and resolve the field data
      Throws:
      IOException
    • readMethods

      protected void readMethods(DataInputStream in) throws IOException
      Read and resolve the method data
      Throws:
      IOException
    • readInterfaces

      protected void readInterfaces(DataInputStream in) throws IOException
      Read and resolve the interface data
      Throws:
      IOException
    • handleAttributes

      protected boolean handleAttributes(DataInputStream in, EAttribute attributeTag, int attributeLength) throws IOException
      Read and resolve the attribute data
      Overrides:
      handleAttributes in class MemberData<ClassData>
      Throws:
      IOException
    • read

      public void read(DataInputStream in, Path src) throws IOException
      Read and resolve the class data
      Throws:
      IOException
    • initClassNames

      private void initClassNames(int this_cpx)
      Initializes class, package names needed for printing asm file
      Parameters:
      this_cpx - The constant_pool entry at that index is a CONSTANT_Class_info structure (ยง4.4.1) representing the class or interface defined by this class file or this_class is module-info in the case of a module.
    • hasPackage

      public boolean hasPackage()
      Determines if this Class has a package
      Returns:
      true if the package exists for this class
    • getSrcLine

      public String getSrcLine(int lineNum)
      Read and resolve the attribute data
    • printAnnotations

      @SafeVarargs private <T extends AnnotationData> void printAnnotations(List<T>... annotationLists) throws IOException
      Throws:
      IOException
    • print

      public void print() throws IOException
      Print asm file.
      Specified by:
      print in interface Printable
      Overrides:
      print in class Indenter
      Throws:
      IOException
    • getListOfPrintableAttributes

      private <P extends Printable> List<P> getListOfPrintableAttributes(P... attributes)
    • isPrintable

      private <P extends Printable> boolean isPrintable(P... attributes)
    • printAttributes

      private <P extends Printable> int printAttributes(int commentOffset, List<P> attributeList) throws IOException
      Returns number of corrupted attributes if any
      Throws:
      IOException
    • getCorruptedAttributes

      private List<AttrData> getCorruptedAttributes()
    • printMemberDataList

      private boolean printMemberDataList(List<? extends MemberData> list, int commentOffset) throws IOException
      Prints list of either fields or methods
      Parameters:
      list - a list of fields or methods to be printed
      Returns:
      true if something were printed
      Throws:
      IOException - if something goes wrong