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.
-
access_flags
-
-
attributes
-
-
class_name
-
-
class_name_index
-
-
constant_pool
-
-
debug
-
-
fields
-
-
file_name
-
-
interface_names
-
-
interfaces
-
-
major
-
-
methods
-
-
minor
-
-
sep
-
-
source_file_name
-
-
superclass_name
-
-
superclass_name_index
-
-
JavaClass(int, int, String, int, int, int, ConstantPool, int[], Field[], Method[], Attribute[])
- Constructor gets all contents as arguments.
-
accept(Visitor)
- Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class.
-
Debug(String)
-
-
dump(DataOutputStream)
-
Dump Java class to output stream in binary format.
-
dump(File)
-
Dump class to a file, this should create a valid .class file.
-
dump(String)
-
Dump class to a file, this should create a valid .class file.
-
getAccessFlags()
-
-
getAttributes()
-
-
getClassName()
-
-
getClassNameIndex()
-
-
getConstantPool()
-
-
getFields()
-
-
getFileName()
-
-
getInterfaceNames()
-
-
getInterfaces()
-
-
getMajor()
-
-
getMethods()
-
-
getMinor()
-
-
getSourceFileName()
-
-
getSuperclassName()
-
-
getSuperclassNameIndex()
-
-
initJavaClass()
- Initialize the package.
-
setAccessFlags(int)
-
-
setAttributes(Attribute[])
-
-
setClassName(String)
-
-
setClassNameIndex(int)
-
-
setConstantPool(ConstantPool)
-
-
setFields(Field[])
-
-
setFileName(String)
-
-
setInterfaceNames(String[])
-
-
setInterfaces(int[])
-
-
setMajor(int)
-
-
setMethods(Method[])
-
-
setMinor(int)
-
-
setSourceFileName(String)
-
-
setSuperclassName(String)
-
-
setSuperclassNameIndex(int)
-
-
toString()
-
file_name
private String file_name
source_file_name
private String source_file_name
class_name_index
private int class_name_index
superclass_name_index
private int superclass_name_index
class_name
private String class_name
superclass_name
private String superclass_name
major
private int major
minor
private int minor
access_flags
private int access_flags
constant_pool
private ConstantPool constant_pool
interfaces
private int interfaces[]
interface_names
private String interface_names[]
fields
private Field fields[]
methods
private Method methods[]
attributes
private Attribute attributes[]
debug
static boolean debug
sep
static char sep
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
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
Debug
static final void Debug(String str)
dump
public void dump(File file) throws IOException
- Dump class to a file, this should create a valid .class file.
- Parameters:
- file - Output file
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
dump
public void dump(DataOutputStream file) throws IOException
- Dump Java class to output stream in binary format.
- Parameters:
- file - Output stream
getAccessFlags
public final int getAccessFlags()
- Returns:
- Access rights of class.
getAttributes
public final Attribute[] getAttributes()
- Returns:
- Attributes of the class.
getClassName
public final String getClassName()
- Returns:
- Class name.
getClassNameIndex
public final int getClassNameIndex()
- Returns:
- Class name index.
getConstantPool
public final ConstantPool getConstantPool()
- Returns:
- Constant pool.
getFields
public final Field[] getFields()
- Returns:
- Fields, i.e. variables of the class.
getFileName
public final String getFileName()
- Returns:
- File name.
getInterfaceNames
public final String[] getInterfaceNames()
- Returns:
- Names of implemented interfaces.
getInterfaces
public final int[] getInterfaces()
- Returns:
- Implemented interfaces.
getMajor
public final int getMajor()
- Returns:
- Major number of compiler version.
getMethods
public final Method[] getMethods()
- Returns:
- Methods of the class.
getMinor
public final int getMinor()
- Returns:
- Minor number of compiler version.
getSourceFileName
public final String getSourceFileName()
- Returns:
- File name of source.
getSuperclassName
public final String getSuperclassName()
- Returns:
- Superclass name.
getSuperclassNameIndex
public final int getSuperclassNameIndex()
- Returns:
- Class name index.
initJavaClass
public static void initJavaClass()
- Initialize the package.
setAccessFlags
public final void setAccessFlags(int access_flags)
setAttributes
public final void setAttributes(Attribute attributes[])
setClassName
public final void setClassName(String class_name)
setClassNameIndex
public final void setClassNameIndex(int class_name_index)
setConstantPool
public final void setConstantPool(ConstantPool constant_pool)
setFields
public final void setFields(Field fields[])
setFileName
public final void setFileName(String file_name)
setInterfaceNames
public final void setInterfaceNames(String interface_names[])
setInterfaces
public final void setInterfaces(int interfaces[])
setMajor
public final void setMajor(int major)
setMethods
public final void setMethods(Method methods[])
setMinor
public final void setMinor(int minor)
setSourceFileName
public final void setSourceFileName(String source_file_name)
setSuperclassName
public final void setSuperclassName(String superclass_name)
setSuperclassNameIndex
public final void setSuperclassNameIndex(int superclass_name_index)
toString
public String toString()
- Returns:
- String representing class contents.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index