Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ClassParser Class Reference

Inheritance diagram for ClassParser:
[legend]
Collaboration diagram for ClassParser:
[legend]
List of all members.

Public Methods

 ClassParser (InputStream file, String file_name)
 ClassParser (String file_name) throws IOException
 ClassParser (String zip_file, String file_name) throws IOException
JavaClass parse () throws IOException, ClassFormatError
 ClassParser (InputStream file, String file_name)
 ClassParser (String file_name) throws IOException
 ClassParser (String zip_file, String file_name) throws IOException
JavaClass parse () throws IOException, ClassFormatError

Private Methods

final void readAttributes () throws IOException, ClassFormatError
final void readClassInfo () throws IOException, ClassFormatError
final void readConstantPool () throws IOException, ClassFormatError
final void readFields () throws IOException, ClassFormatError
final void readID () throws IOException, ClassFormatError
final void readInterfaces () throws IOException, ClassFormatError
final void readMethods () throws IOException, ClassFormatError
final void readVersion () throws IOException, ClassFormatError
final void readAttributes () throws IOException, ClassFormatError
final void readClassInfo () throws IOException, ClassFormatError
final void readConstantPool () throws IOException, ClassFormatError
final void readFields () throws IOException, ClassFormatError
final void readID () throws IOException, ClassFormatError
final void readInterfaces () throws IOException, ClassFormatError
final void readMethods () throws IOException, ClassFormatError
final void readVersion () throws IOException, ClassFormatError

Private Attributes

DataInputStream file
ZipFile zip
String file_name
int class_name_index
int superclass_name_index
int major
int minor
int access_flags
int[] interfaces
ConstantPool constant_pool
Field[] fields
Method[] methods
Attribute[] attributes
int[] interfaces
Field[] fields
Method[] methods
Attribute[] attributes
boolean is_zip

Static Private Attributes

final int BUFSIZE = 8192

Detailed Description

Wrapper class that parses a given Java .class file. The method parse returns a JavaClass object on success. When an I/O error or an inconsistency occurs an appropiate exception is propagated back to the caller.

The structure and the names comply, except for a few conveniences, exactly with the JVM specification 1.0. See this paper for further details about the structure of a bytecode file.

Version:
Id:
ClassParser.java,v 1.1.1.1 2002/01/24 03:44:00 pserver Exp
Author:
M. Dahm

Definition at line 23 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.


Constructor & Destructor Documentation

ClassParser::ClassParser InputStream   file,
String   file_name
[inline]
 

Parse class from the given stream.

Parameters:
file   Input stream
file_name   File name

Definition at line 44 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

ClassParser::ClassParser String   file_name [inline]
 

Parse class from given .class file.

Parameters:
file_name   file name
Exceptions:
IOException  

Definition at line 57 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

ClassParser::ClassParser String   zip_file,
String   file_name
[inline]
 

Parse class from given .class file in a ZIP-archive

Parameters:
file_name   file name
Exceptions:
IOException  

Definition at line 68 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

ClassParser::ClassParser InputStream   file,
String   file_name
[inline]
 

Parse class from the given stream.

Parameters:
file   Input stream
file_name   File name

Definition at line 45 of file src/de/fub/bytecode/classfile/ClassParser.java.

ClassParser::ClassParser String   file_name [inline]
 

Parse class from given .class file.

Parameters:
file_name   file name
Exceptions:
IOException  

Definition at line 61 of file src/de/fub/bytecode/classfile/ClassParser.java.

ClassParser::ClassParser String   zip_file,
String   file_name
[inline]
 

Parse class from given .class file in a ZIP-archive

Parameters:
file_name   file name
Exceptions:
IOException  

Definition at line 73 of file src/de/fub/bytecode/classfile/ClassParser.java.


Member Function Documentation

JavaClass ClassParser::parse   [inline]
 

Parse the given Java class file and return an object that represents the contained data, i.e., constants, methods, fields and commands. A ClassFormatError is raised, if the file is not a valid .class file. (This does not include verification of the byte code as it is performed by the java interpreter).

Returns:
Class object representing the parsed class file
Exceptions:
IOException  
ClassFormatError  

Definition at line 95 of file src/de/fub/bytecode/classfile/ClassParser.java.

JavaClass ClassParser::parse   [inline]
 

Parse the given Java class file and return an object that represents the contained data, i.e. constants, methods, fields and commands. A ClassFormatError is raised, if the file is not a valid .class file. (This does not include verification of the byte code as it is performed by the java interpreter).

Returns:
Class object representing the parsed class file
Exceptions:
IOException  
ClassFormatError  

Definition at line 89 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readAttributes   [inline, private]
 

Read information about the attributes of the attributes of the class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 157 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readAttributes   [inline, private]
 

Read information about the attributes of the attributes of the class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 149 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readClassInfo   [inline, private]
 

Read information about the class and its super class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 172 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readClassInfo   [inline, private]
 

Read information about the class and its super class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 164 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readConstantPool   [inline, private]
 

Read constant pool entries.

Exceptions:
IOException  
ClassFormatError  

Definition at line 194 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readConstantPool   [inline, private]
 

Read constant pool entries.

Exceptions:
IOException  
ClassFormatError  

Definition at line 186 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readFields   [inline, private]
 

Read information about the fields of the class, i.e., its variables.

Exceptions:
IOException  
ClassFormatError  

Definition at line 203 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readFields   [inline, private]
 

Read information about the fields of the class, i.e. its variables.

Exceptions:
IOException  
ClassFormatError  

Definition at line 195 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readID   [inline, private]
 

Check whether the header of the file is ok. Of course, this has to be the first action on successive file reads.

Exceptions:
IOException  
ClassFormatError  

Definition at line 221 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readID   [inline, private]
 

Check whether the header of the file is ok. Of course, this has to be the first action on successive file reads.

Exceptions:
IOException  
ClassFormatError  

Definition at line 215 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readInterfaces   [inline, private]
 

Read information about the interfaces implemented by this class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 233 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readInterfaces   [inline, private]
 

Read information about the interfaces implemented by this class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 227 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readMethods   [inline, private]
 

Read information about the methods of the class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 248 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readMethods   [inline, private]
 

Read information about the methods of the class.

Exceptions:
IOException  
ClassFormatError  

Definition at line 242 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().

final void ClassParser::readVersion   [inline, private]
 

Read major and minor version of compiler which created the file.

Exceptions:
IOException  
ClassFormatError  

Definition at line 263 of file src/de/fub/bytecode/classfile/ClassParser.java.

final void ClassParser::readVersion   [inline, private]
 

Read major and minor version of compiler which created the file.

Exceptions:
IOException  
ClassFormatError  

Definition at line 257 of file lib/jpf/de/fub/bytecode/classfile/ClassParser.java.

Referenced by parse().


The documentation for this class was generated from the following files:
Generated at Thu Feb 7 07:06:31 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001