Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional.depend

public Class ClassFile

extends Object
Class Inheritance
Imports
java.io.DataInputStream, .IOException, .InputStream, java.util.Vector, org.apache.tools.ant.taskdefs.optional.depend.constantpool.ClassCPInfo, .ConstantPool, .ConstantPoolEntry

A ClassFile object stores information about a Java class. The class may be read from a DataInputStream.and written to a DataOutputStream. These are usually streams from a Java class file or a class file component of a Jar file.

Field Summary

Modifier and TypeField and Description
private static final int
CLASS_MAGIC

The Magic Value that marks the start of a Java class file

private String
className

The class name for this class.

private ConstantPool
constantPool

This class' constant pool.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Vector<String>

Returns:

a vector of class names which this class references
getClassRefs
()

Get the classes which this class references.

public String

Returns:

the class name in dot format (eg. java.lang.Object)
getFullClassName
()

Get the class' fully qualified name in dot format.

public void
read(InputStream
an InputStream from which the class will be read
stream
)

Read the class from a data stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLASS_MAGICback to summary
private static final int CLASS_MAGIC

The Magic Value that marks the start of a Java class file

classNameback to summary
private String className

The class name for this class.

constantPoolback to summary
private ConstantPool constantPool

This class' constant pool.

Constructor Detail

ClassFileback to summary
public ClassFile()

Method Detail

getClassRefsback to summary
public Vector<String> getClassRefs()

Get the classes which this class references.

Returns:Vector<String>

a vector of class names which this class references

getFullClassNameback to summary
public String getFullClassName()

Get the class' fully qualified name in dot format.

Returns:String

the class name in dot format (eg. java.lang.Object)

readback to summary
public void read(InputStream stream) throws IOException, ClassFormatError

Read the class from a data stream. This method takes an InputStream as input and parses the class from the stream.

Parameters
stream:InputStream

an InputStream from which the class will be read

Exceptions
IOException:
if there is a problem reading from the given stream.
ClassFormatError:
if the class cannot be parsed correctly