All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.fub.bytecode.classfile.JavaClass

java.lang.Object
   |
   +----de.fub.bytecode.classfile.AccessFlags
           |
           +----de.fub.bytecode.classfile.JavaClass

public class JavaClass
extends AccessFlags
implements Constants, Cloneable
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.

Version:
$Id: JavaClass.java,v 1.15 2000/02/21 11:48:10 dahm Exp $
Author:
M. Dahm

Variable Index

 o FILE
 o HEAP
 o ZIP

Constructor Index

 o JavaClass(int, int, String, int, int, int, ConstantPool, int[], Field[], Method[], Attribute[])
Constructor gets all contents as arguments.
 o JavaClass(int, int, String, int, int, int, ConstantPool, int[], Field[], Method[], Attribute[], byte)
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 copy()
 o dump(DataOutputStream)
Dump Java class to output stream in binary format.
 o dump(File)
Dump class to a file.
 o dump(OutputStream)
Dump Java class to output stream in binary format.
 o dump(String)
Dump class to a file named file_name.
 o getAttributes()
 o getBytes()
 o getClassName()
 o getClassNameIndex()
 o getConstantPool()
 o getFields()
 o getFileName()
 o getInterfaceNames()
 o getInterfaces()
 o getMajor()
 o getMethods()
 o getMinor()
 o getPackageName()
 o getSource()
 o getSourceFileName()
 o getSuperclassName()
 o getSuperclassNameIndex()
 o instanceOf(JavaClass)
 o isClass()
 o isSuper()
 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 HEAP
 public static final byte HEAP
 o FILE
 public static final byte FILE
 o ZIP
 public static final byte ZIP

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[],
                  byte source)
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
source - Read from file or generated in memory?
 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 dump
 public void dump(File file) throws IOException
Dump class to a file.

Parameters:
file - Output file
 o dump
 public void dump(String file_name) throws IOException
Dump class to a file named file_name.

Parameters:
file_name - Output file name
 o getBytes
 public byte[] getBytes()
Returns:
class in binary format
 o dump
 public void dump(OutputStream file) throws IOException
Dump Java class to output stream in binary format.

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

Parameters:
file - Output stream
 o getAttributes
 public Attribute[] getAttributes()
Returns:
Attributes of the class.
 o getClassName
 public String getClassName()
Returns:
Class name.
 o getPackageName
 public String getPackageName()
Returns:
Package name.
 o getClassNameIndex
 public int getClassNameIndex()
Returns:
Class name index.
 o getConstantPool
 public ConstantPool getConstantPool()
Returns:
Constant pool.
 o getFields
 public Field[] getFields()
Returns:
Fields, i.e. variables of the class.
 o getFileName
 public String getFileName()
Returns:
File name.
 o getInterfaceNames
 public String[] getInterfaceNames()
Returns:
Names of implemented interfaces.
 o getInterfaces
 public int[] getInterfaces()
Returns:
Implemented interfaces.
 o getMajor
 public int getMajor()
Returns:
Major number of compiler version.
 o getMethods
 public Method[] getMethods()
Returns:
Methods of the class.
 o getMinor
 public int getMinor()
Returns:
Minor number of compiler version.
 o getSourceFileName
 public String getSourceFileName()
Returns:
File name of source.
 o getSuperclassName
 public String getSuperclassName()
Returns:
Superclass name.
 o getSuperclassNameIndex
 public int getSuperclassNameIndex()
Returns:
Class name index.
 o setAttributes
 public void setAttributes(Attribute attributes[])
 o setClassName
 public void setClassName(String class_name)
 o setClassNameIndex
 public void setClassNameIndex(int class_name_index)
 o setConstantPool
 public void setConstantPool(ConstantPool constant_pool)
 o setFields
 public void setFields(Field fields[])
 o setFileName
 public void setFileName(String file_name)
 o setInterfaceNames
 public void setInterfaceNames(String interface_names[])
 o setInterfaces
 public void setInterfaces(int interfaces[])
 o setMajor
 public void setMajor(int major)
 o setMethods
 public void setMethods(Method methods[])
 o setMinor
 public void setMinor(int minor)
 o setSourceFileName
 public void setSourceFileName(String source_file_name)
 o setSuperclassName
 public void setSuperclassName(String superclass_name)
 o setSuperclassNameIndex
 public void setSuperclassNameIndex(int superclass_name_index)
 o toString
 public String toString()
Returns:
String representing class contents.
Overrides:
toString in class Object
 o copy
 public JavaClass copy()
Returns:
deep copy of this class
 o instanceOf
 public final boolean instanceOf(JavaClass super_class)
 o isSuper
 public final boolean isSuper()
 o isClass
 public final boolean isClass()
 o getSource
 public final byte getSource()
Returns:
returns either HEAP (generated), FILE, or ZIP

All Packages  Class Hierarchy  This Package  Previous  Next  Index