mjc

org.multijava.util.classfile
Interface AttributeParser

All Known Implementing Classes:
BaseAttributeParser, MJAttributeParser, UniverseAttributeParser

public interface AttributeParser

This interface is implemented by all classes which can participate in the chain-of-responsibility for parsing Attributes from bytecode. The chain-of-responsibility is established via static methods of AttributeList.

Version:
$Revision: 1.1 $
Author:
Curtis Clifton

Method Summary
 Attribute read(String tag, DataInput in, ConstantPool cp)
          Checks the next attribute in the given input, in, and parses it if it is recognized.
 Attribute readCodeInfoAttribute(String tag, DataInput in, ConstantPool cp, Instruction[] insns)
          Checks the next attribute in the given input, in, and parses it if it is recognized, but only parses attributes that may appear within a CodeInfo attribute.
 Attribute readInterfaceOnly(String tag, DataInput in, ConstantPool cp)
          Checks the next attribute in the given input, in, and parses it if it is recognized, but skips CodeInfo attributes.
 

Method Detail

read

public Attribute read(String tag,
                      DataInput in,
                      ConstantPool cp)
                        throws IOException,
                               ClassFileFormatException
Checks the next attribute in the given input, in, and parses it if it is recognized.

Parameters:
tag - a String giving the name of the next attribute in in
in - an input stream for the bytecode ClassInfo being parsed, whose read cursor is positioned just after the attribute_name_index of the next attribute (see JVM2, 4.7)
cp - the ConstantPool for the bytecode ClassInfo being parsed
Returns:
an Attribute value if the next bytes in in represent an Attribute recognized by this, or null if the next bytes are not recognized
Throws:
IOException - if an error occurs while reading from the bytecode file represented by in
ClassFileFormatException - if the next bytes begin like a recognized Attribute but are then malformed

readInterfaceOnly

public Attribute readInterfaceOnly(String tag,
                                   DataInput in,
                                   ConstantPool cp)
                                     throws IOException,
                                            ClassFileFormatException
Checks the next attribute in the given input, in, and parses it if it is recognized, but skips CodeInfo attributes.

Parameters:
tag - a String giving the name of the next attribute in in
in - an input stream for the bytecode ClassInfo being parsed, whose read cursor is positioned just after the attribute_name_index of the next attribute (see JVM2, 4.7)
cp - the ConstantPool for the bytecode ClassInfo being parsed
Returns:
an Attribute value if the next bytes in in represent an Attribute recognized by this, or null if the next bytes are not recognized
Throws:
IOException - if an error occurs while reading from the bytecode file represented by in
ClassFileFormatException - if the next bytes begin like a recognized Attribute but are then malformed

readCodeInfoAttribute

public Attribute readCodeInfoAttribute(String tag,
                                       DataInput in,
                                       ConstantPool cp,
                                       Instruction[] insns)
                                         throws IOException,
                                                ClassFileFormatException
Checks the next attribute in the given input, in, and parses it if it is recognized, but only parses attributes that may appear within a CodeInfo attribute.

Parameters:
tag - a String giving the name of the next attribute in in
in - an input stream for the bytecode ClassInfo being parsed, whose read cursor is positioned just after the attribute_name_index of the next attribute (see JVM2, 4.7)
cp - the ConstantPool for the bytecode ClassInfo being parsed
insns - (sparse) array of instructions
Returns:
an Attribute value if the next bytes in in represent an Attribute recognized by this, or null if the next bytes are not recognized
Throws:
IOException - if an error occurs while reading from the bytecode file represented by in
ClassFileFormatException - if the next bytes begin like a recognized Attribute but are then malformed or if the next bytes are not valid within a CodeInfo attribute

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.