Class ClassFile

  • All Implemented Interfaces:
    VMConstants

    public final class ClassFile
    extends Object
    implements VMConstants
    ClassFile models the structure of a class as represented within a class file.
    • Field Detail

      • jdkMajorMinorVersions

        public static final short[][] jdkMajorMinorVersions
      • jdkVersions

        public static final List jdkVersions
      • supportedVersions

        public static final String supportedVersions
    • Method Detail

      • pool

        public ConstantPool pool()
        Return the constant pool for the class file
      • access

        public int access()
        Return the access flags for the class - see VMConstants
      • isFinal

        public final boolean isFinal()
        Is the class final?
      • isInterface

        public final boolean isInterface()
        Is the class an interface?
      • isPublic

        public final boolean isPublic()
        Is the class public?
      • isAbstract

        public final boolean isAbstract()
        Is the class abstract?
      • setAccessFlags

        public void setAccessFlags​(int flags)
        Set the access flags for the class - see VMConstants
      • className

        public ConstClass className()
        Return the name of the class
      • superName

        public ConstClass superName()
        Return the name of the super class
      • superNameString

        public String superNameString()
        Return the name of the super class as a string
      • setSuperName

        public void setSuperName​(ConstClass superCl)
        Set the name of the super class
      • interfaces

        public Vector interfaces()
        Return the list of the interfaces which the class implements The contents are ConstClass objects
      • addInterface

        public void addInterface​(ConstClass iface)
        Add an interface to the list of the interfaces which the class implements
      • fields

        public Vector fields()
        Return the list of the fields which the class contains The contents are ClassField objects
      • addField

        public void addField​(ClassField field)
        Add a field to the list of the fields which the class contains
      • addField

        public void addField​(ClassField field,
                             int index)
        Add a field to the list of the fields which the class contains, at the index'th position.
      • methods

        public Vector methods()
        Return the list of the methods which the class defines The contents are ClassMethod objects
      • findMethod

        public ClassMethod findMethod​(String methodName,
                                      String methodSig)
        Look for a method with the specified name and type signature
      • addMethod

        public void addMethod​(ClassMethod method)
        Add a method to the list of the methods which the class defines
      • findField

        public ClassField findField​(String fieldName)
        Look for a field with the specified name
      • attributes

        public AttributeVector attributes()
        Return the list of the attributes associated with the class
      • getBytes

        public byte[] getBytes()
                        throws IOException
        Returns a byte array representation of this class.
        Throws:
        IOException
      • summarize

        public void summarize()
      • printSupportedVersions

        public static final String printSupportedVersions()