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.
-
attributes
-
-
constants
-
-
fields
-
-
fullClassName
-
-
hdrAccessFlags
-
-
hdrMagic
- The 32-bit "magic number" of the class file.
-
hdrMajor
- The major version of the class file (should be JAVA_VERSION = 3).
-
hdrMinor
- The minor version of the class file (should be JAVA_MINOR_VERSION = 45).
-
hdrSuperClassName
-
-
hdrThisClassName
-
-
interfaces
-
-
methods
-
-
JcfClassFile()
-
-
JcfClassFile(JcfClassInput)
- Instantiates a new JcfClassFile by reading its data from a JcfClassInput.
-
getAttributes()
-
-
getConstantPool()
-
-
getFields()
-
-
getFullName()
-
-
getInterfaces()
-
-
getMethods()
-
-
isValidMagic(int)
- Returns true if "magic" matches a specific magic header signature value.
-
read(JcfClassInput)
- Initializes a JcfClassFile by reading its data from a JcfClassInput.
-
readAttributes(JcfClassInput)
- Instantiates a new JcfAttributeCollection (or a subclass), read from a
JcfClassInput.
-
readConstantPool(JcfClassInput)
- Instantiates a new JcfConstantPool (or a subclass), read from a
JcfClassInput.
-
readInterfaces(JcfClassInput)
- Instantiates a new JcfInterfaceCollection (or a subclass), read from a
JcfClassInput.
-
readMemberCollection(JcfClassInput)
- Instantiates a new JcfMemberCollection (or a subclass), read from a
JcfClassInput.
-
write(JcfClassOutput)
- Writes out the (potentially updated) class file to a JcfClassOutput.
hdrMagic
public int hdrMagic
- The 32-bit "magic number" of the class file. Should be
RuntimeConstants.JAVA_MAGIC (0xcafebabe)
hdrMajor
public short hdrMajor
- The major version of the class file (should be JAVA_VERSION = 3).
hdrMinor
public short hdrMinor
- The minor version of the class file (should be JAVA_MINOR_VERSION = 45).
fullClassName
protected String fullClassName
constants
protected JcfConstantPool constants
hdrAccessFlags
public short hdrAccessFlags
hdrThisClassName
public short hdrThisClassName
hdrSuperClassName
public short hdrSuperClassName
interfaces
protected JcfInterfaceCollection interfaces
fields
protected JcfMemberCollection fields
methods
protected JcfMemberCollection methods
attributes
protected JcfAttributeCollection attributes
JcfClassFile
public JcfClassFile()
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().
getFullName
public final String getFullName()
getConstantPool
public final JcfConstantPool getConstantPool()
getInterfaces
public final JcfInterfaceCollection getInterfaces()
getFields
public final JcfMemberCollection getFields()
getMethods
public final JcfMemberCollection getMethods()
getAttributes
public final JcfAttributeCollection getAttributes()
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.
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.
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.
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.
isValidMagic
public boolean isValidMagic(int magic)
- Returns true if "magic" matches a specific magic header signature value.
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.
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