|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.java.Accessible | +--edu.wisc.cs.java.ClassFile
This object maintains a Class_file table, as specified by the Java Virtual Machine specification for class files.
Field Summary | |
protected AttributeInfo[] |
attributes
An array of AttributeInfo objects which represent the general attributes of thie class. |
protected ConstantPool |
constants
The constant pool for this class. |
protected java.util.Vector |
fields
An array of FieldInfo objects which represent the fields of thie class. |
protected java.lang.String |
filename
The name of the file from which this class was read. |
protected char[] |
interfaces
An array of indeces into the constant pool which are the interfaces directly implemented by this class. |
static int |
MAGIC
All valid classfiles begin with this four byte number. |
static int |
MAJOR_FILE_VERSION
The major file version number this class was designed to read and write. |
protected int |
major_version
The major version number for this class file. |
protected java.util.Vector |
methods
An array of MethodInfo objects which represent the methods of thie class. |
static int |
MINOR_FILE_VERSION
The minor file version number this class was designed to read and write. |
protected int |
minor_version
The minor version number for this class file. |
protected char |
super_class
An index into the constant pool containing the symbolic reference to the super class. |
protected char |
this_class
An index into the constant pool containing the symbolic reference to this class. |
Fields inherited from class edu.wisc.cs.java.Accessible |
ACC_ABSTRACT,
ACC_FINAL,
ACC_INTERFACE,
ACC_NATIVE,
ACC_PRIVATE,
ACC_PROTECTED,
ACC_PUBLIC,
ACC_STATIC,
ACC_SUPER,
ACC_SYNCHRONIZED,
ACC_TRANSIENT,
ACC_VOLATILE,
access_flags |
Constructor Summary | |
ClassFile(java.io.File file)
Constructs a new ClassFile object by reading data from the specified file. |
Method Summary | |
FieldInfo |
addField(int access,
java.lang.String name,
java.lang.String desc)
Adds a new field to the class with the given access flags, name, and type. |
MethodInfo |
addMethod(int access,
java.lang.String name,
java.lang.String desc)
Adds a new method to the class with the given access flags, name, and type. |
java.lang.String |
getClassName()
Returns the name of the class. |
ConstantPool |
getConstantPool()
Returns the constant pool for this class. |
java.util.Enumeration |
getFields()
Returns an enumeration containing all of the fields for this class. |
java.lang.String |
getFileName()
Returns the name of the file from which this class was read. |
int |
getMajorVersion()
Returns the major version number of this class file. |
java.util.Enumeration |
getMethods()
Returns an enumeration containing all of the methods for this class. |
int |
getMinorVersion()
Returns the minor version number of this class file. |
java.lang.String |
getSuperClass()
Returns the name of the superclass. |
void |
printData(java.io.PrintStream out)
Writes textual information about the class represented by this ClassFile object to the specified destination. |
void |
writeClassFile(java.io.File f)
Writes a class file according to the Java Virtual Machine specification. |
Methods inherited from class edu.wisc.cs.java.Accessible |
getFlag,
setFlag,
unSetFlag |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int MAGIC
public static final int MAJOR_FILE_VERSION
public static final int MINOR_FILE_VERSION
protected java.lang.String filename
protected int major_version
protected int minor_version
protected char this_class
protected char super_class
protected ConstantPool constants
protected char[] interfaces
protected java.util.Vector fields
protected java.util.Vector methods
protected AttributeInfo[] attributes
Constructor Detail |
public ClassFile(java.io.File file) throws java.io.EOFException
filename
- String containing the name a path of a class file.Method Detail |
public java.lang.String getFileName()
public int getMajorVersion()
public int getMinorVersion()
public ConstantPool getConstantPool()
public FieldInfo addField(int access, java.lang.String name, java.lang.String desc)
access
- a bit field with the desired acess flags set.name
- the name of the new field.desc
- the descriptor for the new field.public MethodInfo addMethod(int access, java.lang.String name, java.lang.String desc)
access
- a bit field with the desired acess flags set.name
- the name of the new field.desc
- the descriptor for the new field.public java.util.Enumeration getFields()
public java.util.Enumeration getMethods()
public java.lang.String getSuperClass()
public java.lang.String getClassName()
public void writeClassFile(java.io.File f) throws java.io.IOException
f
- a file object representing the file on disk to write.public void printData(java.io.PrintStream out)
out
- a PrintStream connected to the desired destination.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |