All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class lti.java.jcf.JcfClassFile

java.lang.Object
   |
   +----lti.java.jcf.JcfClassFile

public class JcfClassFile
extends Object
implements RuntimeConstants
The JcfClassFile class is an in-memory representation of the structure and format of a Java 1.x class file. JcfClassFile maintains references to various objects representing subsections of a class file, and allows loading, manipulation, and saving of class files.


Variable Index

 o attributes
 o constants
 o fields
 o fullClassName
 o hdrAccessFlags
 o hdrMagic
The 32-bit "magic number" of the class file.
 o hdrMajor
The major version of the class file (should be JAVA_VERSION = 3).
 o hdrMinor
The minor version of the class file (should be JAVA_MINOR_VERSION = 45).
 o hdrSuperClassName
 o hdrThisClassName
 o interfaces
 o methods

Constructor Index

 o JcfClassFile()
 o JcfClassFile(JcfClassInput)
Instantiates a new JcfClassFile by reading its data from a JcfClassInput.

Method Index

 o getAttributes()
 o getConstantPool()
 o getFields()
 o getFullName()
 o getInterfaces()
 o getMethods()
 o isValidMagic(int)
Returns true if "magic" matches a specific magic header signature value.
 o read(JcfClassInput)
Initializes a JcfClassFile by reading its data from a JcfClassInput.
 o readAttributes(JcfClassInput)
Instantiates a new JcfAttributeCollection (or a subclass), read from a JcfClassInput.
 o readConstantPool(JcfClassInput)
Instantiates a new JcfConstantPool (or a subclass), read from a JcfClassInput.
 o readInterfaces(JcfClassInput)
Instantiates a new JcfInterfaceCollection (or a subclass), read from a JcfClassInput.
 o readMemberCollection(JcfClassInput)
Instantiates a new JcfMemberCollection (or a subclass), read from a JcfClassInput.
 o write(JcfClassOutput)
Writes out the (potentially updated) class file to a JcfClassOutput.

Variables

 o hdrMagic
 public int hdrMagic
The 32-bit "magic number" of the class file. Should be RuntimeConstants.JAVA_MAGIC (0xcafebabe)

 o hdrMajor
 public short hdrMajor
The major version of the class file (should be JAVA_VERSION = 3).

 o hdrMinor
 public short hdrMinor
The minor version of the class file (should be JAVA_MINOR_VERSION = 45).

 o fullClassName
 protected String fullClassName
 o constants
 protected JcfConstantPool constants
 o hdrAccessFlags
 public short hdrAccessFlags
 o hdrThisClassName
 public short hdrThisClassName
 o hdrSuperClassName
 public short hdrSuperClassName
 o interfaces
 protected JcfInterfaceCollection interfaces
 o fields
 protected JcfMemberCollection fields
 o methods
 protected JcfMemberCollection methods
 o attributes
 protected JcfAttributeCollection attributes

Constructors

 o JcfClassFile
 public JcfClassFile()
 o JcfClassFile
 public JcfClassFile(JcfClassInput ist) throws IOException, ClassFormatError
Instantiates a new JcfClassFile by reading its data from a JcfClassInput. The only function of this method is to invoke read().

Methods

 o getFullName
 public final String getFullName()
 o getConstantPool
 public final JcfConstantPool getConstantPool()
 o getInterfaces
 public final JcfInterfaceCollection getInterfaces()
 o getFields
 public final JcfMemberCollection getFields()
 o getMethods
 public final JcfMemberCollection getMethods()
 o getAttributes
 public final JcfAttributeCollection getAttributes()
 o readConstantPool
 public JcfConstantPool readConstantPool(JcfClassInput ist) throws IOException
Instantiates a new JcfConstantPool (or a subclass), read from a JcfClassInput. Override to return a user-defined subclass of JcfConstantPool.

Parameters:
ist - The JcfClassInput that the constant pool is to be read from.
 o readInterfaces
 public JcfInterfaceCollection readInterfaces(JcfClassInput ist) throws IOException
Instantiates a new JcfInterfaceCollection (or a subclass), read from a JcfClassInput. Override to return a user-defined subclass of JcfInterfaceCollection.

Parameters:
ist - The JcfClassInput that the interface array is to be read from.
 o readMemberCollection
 public JcfMemberCollection readMemberCollection(JcfClassInput ist) throws IOException
Instantiates a new JcfMemberCollection (or a subclass), read from a JcfClassInput. Override to return a user-defined subclass of JcfMemberCollection.

Parameters:
ist - The JcfClassInput that the members are to be read from.
 o readAttributes
 public JcfAttributeCollection readAttributes(JcfClassInput ist) throws IOException
Instantiates a new JcfAttributeCollection (or a subclass), read from a JcfClassInput. Override to return a user-defined subclass of JcfAttributeCollection.

This method is called not only to read the final "attributes" section of the class file, but also for embedded attributes within fields and methods.

Parameters:
ist - The JcfClassInput that the attributes are to be read from.
 o isValidMagic
 public boolean isValidMagic(int magic)
Returns true if "magic" matches a specific magic header signature value.

 o read
 public void read(JcfClassInput ist) throws IOException, ClassFormatError
Initializes a JcfClassFile by reading its data from a JcfClassInput. The data read from the JcfClassInput should constitute a valid Java 1.x class file.

Much of the actual reading of the data is delegated to other classes in this package, which are instantiated as the corresponding part of the class file is read in.

 o write
 public void write(JcfClassOutput ost) throws IOException
Writes out the (potentially updated) class file to a JcfClassOutput. Aster writing header information, the actual writing is delegated to the various subobjects making up the JcfClassFile object.


All Packages  Class Hierarchy  This Package  Previous  Next  Index