All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class espresso.classfile.javaclass.JavaClass

java.lang.Object
   |
   +----espresso.classfile.javaclass.JavaClass

public class JavaClass
extends Object
implements Constants
Represents a Java class, i.e. the data structures, constant pool, fields, methods and commands contained in a Java .class file. See JVM specification for details.


Variable Index

 o access_flags
 o attributes
 o class_name
 o class_name_index
 o constant_pool
 o debug
 o fields
 o file_name
 o interface_names
 o interfaces
 o major
 o methods
 o minor
 o sep
 o source_file_name
 o superclass_name
 o superclass_name_index

Constructor Index

 o JavaClass(int, int, String, int, int, int, ConstantPool, int[], Field[], Method[], Attribute[])
Constructor gets all contents as arguments.

Method Index

 o accept(Visitor)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
 o Debug(String)
 o dump(DataOutputStream)
Dump Java class to output stream in binary format.
 o dump(File)
Dump class to a file, this should create a valid .class file.
 o dump(String)
Dump class to a file, this should create a valid .class file.
 o getAccessFlags()
 o getAttributes()
 o getClassName()
 o getClassNameIndex()
 o getConstantPool()
 o getFields()
 o getFileName()
 o getInterfaceNames()
 o getInterfaces()
 o getMajor()
 o getMethods()
 o getMinor()
 o getSourceFileName()
 o getSuperclassName()
 o getSuperclassNameIndex()
 o initJavaClass()
Initialize the package.
 o setAccessFlags(int)
 o setAttributes(Attribute[])
 o setClassName(String)
 o setClassNameIndex(int)
 o setConstantPool(ConstantPool)
 o setFields(Field[])
 o setFileName(String)
 o setInterfaceNames(String[])
 o setInterfaces(int[])
 o setMajor(int)
 o setMethods(Method[])
 o setMinor(int)
 o setSourceFileName(String)
 o setSuperclassName(String)
 o setSuperclassNameIndex(int)
 o toString()

Variables

 o file_name
 private String file_name
 o source_file_name
 private String source_file_name
 o class_name_index
 private int class_name_index
 o superclass_name_index
 private int superclass_name_index
 o class_name
 private String class_name
 o superclass_name
 private String superclass_name
 o major
 private int major
 o minor
 private int minor
 o access_flags
 private int access_flags
 o constant_pool
 private ConstantPool constant_pool
 o interfaces
 private int interfaces[]
 o interface_names
 private String interface_names[]
 o fields
 private Field fields[]
 o methods
 private Method methods[]
 o attributes
 private Attribute attributes[]
 o debug
 static boolean debug
 o sep
 static char sep

Constructors

 o JavaClass
 public JavaClass(int class_name_index,
                  int superclass_name_index,
                  String file_name,
                  int major,
                  int minor,
                  int access_flags,
                  ConstantPool constant_pool,
                  int interfaces[],
                  Field fields[],
                  Method methods[],
                  Attribute attributes[])
Constructor gets all contents as arguments.

Parameters:
class_name - Class name
superclass_name - Superclass name
file_name - File name
major - Major compiler version
minor - Minor compiler version
access_flags - Access rights defined by bit flags
constant_pool - Array of constants
interfaces - Implemented interfaces
fields - Class fields
methods - Class methods
attributes - Class attributes

Methods

 o accept
 public void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters:
v - Visitor object
 o Debug
 static final void Debug(String str)
 o dump
 public void dump(File file) throws IOException
Dump class to a file, this should create a valid .class file.

Parameters:
file - Output file
 o dump
 public void dump(String file_name) throws IOException
Dump class to a file, this should create a valid .class file.

Parameters:
file_name - Output file name
 o dump
 public void dump(DataOutputStream file) throws IOException
Dump Java class to output stream in binary format.

Parameters:
file - Output stream
 o getAccessFlags
 public final int getAccessFlags()
Returns:
Access rights of class.
 o getAttributes
 public final Attribute[] getAttributes()
Returns:
Attributes of the class.
 o getClassName
 public final String getClassName()
Returns:
Class name.
 o getClassNameIndex
 public final int getClassNameIndex()
Returns:
Class name index.
 o getConstantPool
 public final ConstantPool getConstantPool()
Returns:
Constant pool.
 o getFields
 public final Field[] getFields()
Returns:
Fields, i.e. variables of the class.
 o getFileName
 public final String getFileName()
Returns:
File name.
 o getInterfaceNames
 public final String[] getInterfaceNames()
Returns:
Names of implemented interfaces.
 o getInterfaces
 public final int[] getInterfaces()
Returns:
Implemented interfaces.
 o getMajor
 public final int getMajor()
Returns:
Major number of compiler version.
 o getMethods
 public final Method[] getMethods()
Returns:
Methods of the class.
 o getMinor
 public final int getMinor()
Returns:
Minor number of compiler version.
 o getSourceFileName
 public final String getSourceFileName()
Returns:
File name of source.
 o getSuperclassName
 public final String getSuperclassName()
Returns:
Superclass name.
 o getSuperclassNameIndex
 public final int getSuperclassNameIndex()
Returns:
Class name index.
 o initJavaClass
 public static void initJavaClass()
Initialize the package.

 o setAccessFlags
 public final void setAccessFlags(int access_flags)
 o setAttributes
 public final void setAttributes(Attribute attributes[])
 o setClassName
 public final void setClassName(String class_name)
 o setClassNameIndex
 public final void setClassNameIndex(int class_name_index)
 o setConstantPool
 public final void setConstantPool(ConstantPool constant_pool)
 o setFields
 public final void setFields(Field fields[])
 o setFileName
 public final void setFileName(String file_name)
 o setInterfaceNames
 public final void setInterfaceNames(String interface_names[])
 o setInterfaces
 public final void setInterfaces(int interfaces[])
 o setMajor
 public final void setMajor(int major)
 o setMethods
 public final void setMethods(Method methods[])
 o setMinor
 public final void setMinor(int minor)
 o setSourceFileName
 public final void setSourceFileName(String source_file_name)
 o setSuperclassName
 public final void setSuperclassName(String superclass_name)
 o setSuperclassNameIndex
 public final void setSuperclassNameIndex(int superclass_name_index)
 o toString
 public String toString()
Returns:
String representing class contents.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index