Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.bcel.classfile
Class ClassParser

    java.lang.Object
      |
      +--org.apache.bcel.classfile.ClassParser

public final class ClassParser
extends java.lang.Object

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.5 2002/08/09 13:09:31 mdahm Exp $
Author:
  M. Dahm

Constructor Summary
`ClassParser(java.io.InputStream file, java.lang.String file_name)` Parse class from the given stream.
`ClassParser(java.lang.String file_name)` Parse class from given .class file.
`ClassParser(java.lang.String zip_file, java.lang.String file_name)` Parse class from given .class file in a ZIP-archive

Method Summary
`JavaClass` | `parse()` Parse the given Java class file and return an object that represents the contained data, i.e., constants, methods, fields and commands.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassParser

    public ClassParser(java.io.InputStream file,
                       java.lang.String file_name)

  Parse class from the given stream.

Parameters:
  `file` - Input stream
  `file_name` - File name

### ClassParser

    public ClassParser(java.lang.String file_name)
                throws java.io.IOException

  Parse class from given .class file.

Parameters:
  `file_name` - file name
Throws:
  `java.io.IOException`

### ClassParser

    public ClassParser(java.lang.String zip_file,
                       java.lang.String file_name)
                throws java.io.IOException

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

Parameters:
  `file_name` - file name
Throws:
  `java.io.IOException`

Method Detail

### parse

    public JavaClass parse()
                    throws java.io.IOException,
                           ClassFormatException

  Parse the given Java class file and return an object that represents the contained data, i.e., constants, methods, fields and commands. A ClassFormatException 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
  Throws:
    `java.io.IOException`
    `ClassFormatException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2003 Apache Software Foundation. All Rights Reserved.