JML

org.multijava.util.classfile
Class UniverseAttributeParser

java.lang.Object
  extended byorg.multijava.util.classfile.UniverseAttributeParser
All Implemented Interfaces:
AttributeParser

public class UniverseAttributeParser
extends Object
implements AttributeParser

This class implements an attribute parser that recognizes the JUTS attributes. The parser is inserted into the attribute parsing chain of responsibility.

Author:
AHS
See Also:
AttributeList.addParser(AttributeParser)

Field Summary
private static int firstInterestingPos
           
private static String tagPrefix
          the prefix of all names of attributes this parser may recognize
 
Constructor Summary
UniverseAttributeParser()
           
 
Method Summary
private  boolean isOurs(String tag)
           
 Attribute read(String tag, DataInput in, ConstantPool cp)
          Checks the next attribute in the given input stream, and parses it if is is recognized.
 Attribute readCodeInfoAttribute(String tag, DataInput in, ConstantPool cp, Instruction[] insns)
          Checks the next attribute in the given input stream, and parses it if is 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 stream, and parses it if is is recognized, but skips CodeInfo attributes Returns an Attribute instance if the attribute is recognized, or null otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagPrefix

private static final String tagPrefix
the prefix of all names of attributes this parser may recognize


firstInterestingPos

private static final int firstInterestingPos
Constructor Detail

UniverseAttributeParser

public UniverseAttributeParser()
Method Detail

read

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

Specified by:
read in interface AttributeParser
Parameters:
tag - a String giving the name of the next attribute
in - the input stream for the the bytecode ClassInfo being parsed whose read cursor is positioned just after attribute_name_index of the next attribute (VMS 4.7)
cp - the constant pool for the 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 - an IO error has occurred
ClassFileFormatException - the class file is malformed

readInterfaceOnly

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

Specified by:
readInterfaceOnly in interface AttributeParser
Parameters:
tag - a String giving the name of the next attribute
in - the input stream for the the bytecode ClassInfo being parsed whose read cursor is positioned just after attribute_name_index of the next attribute (VMS 4.7)
cp - the constant pool for the 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 - an IO error has occurred
ClassFileFormatException - the class file is malformed

readCodeInfoAttribute

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

Specified by:
readCodeInfoAttribute in interface AttributeParser
Parameters:
tag - a String giving the name of the next attribute
in - the input stream for the the bytecode ClassInfo being parsed whose read cursor is positioned just after attribute_name_index of the next attribute (VMS 4.7)
cp - the constant pool for the 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 - an IO error has occurred
ClassFileFormatException - the class file is malformed

isOurs

private boolean isOurs(String tag)

JML

JML is Copyright (C) 1998-2002 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. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.