harpoon.IR.RawClass
Class AttributeExceptions

java.lang.Object
  extended by harpoon.IR.RawClass.Attribute
      extended by harpoon.IR.RawClass.AttributeExceptions

public class AttributeExceptions
extends Attribute

The Exceptions attribute is a variable-length attribute used in the attributes table of a method_info structure. The Exceptions attribute indicates which checked exceptions a method may throw. The must be exactly one Exceptions attribute in each method_info structure.

Version:
$Id: AttributeExceptions.java,v 1.3 2003/09/05 21:45:16 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
"The Java Virtual Machine Specification, section 4.7.5", Attribute, MethodInfo

Field Summary
static String ATTRIBUTE_NAME
          The string naming this Attribute type.
 int[] exception_index_table
          Each nonzero value in the exception_index_table must be a valid index into the constant_pool table.
 
Fields inherited from class harpoon.IR.RawClass.Attribute
attribute_name_index, parent
 
Constructor Summary
AttributeExceptions(ClassFile parent, int attribute_name_index, int[] exception_index_table)
          Constructor.
 
Method Summary
 long attribute_length()
          The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.
 ConstantClass exception_index_table(int i)
          Returns the CONSTANT_Class_info corresponding to an entry in the exception_index_table.
 int number_of_exceptions()
           
 void print(PrintWriter pw, int indent)
          Pretty-print the contents of this attribute.
 void write(ClassDataOutputStream out)
          Write to bytecode stream.
 
Methods inherited from class harpoon.IR.RawClass.Attribute
attribute_name_index, attribute_name, read, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
The string naming this Attribute type.

See Also:
Constant Field Values

exception_index_table

public int[] exception_index_table
Each nonzero value in the exception_index_table must be a valid index into the constant_pool table. For each table item, if exception_index_table[i] != 0, where 0 <= i < number_of_exceptions, then the constant_pool entry at index exception_index_table[i] must be a CONSTANT_Class_info structure representing a class type that this method is declared to throw.

Constructor Detail

AttributeExceptions

public AttributeExceptions(ClassFile parent,
                           int attribute_name_index,
                           int[] exception_index_table)
Constructor.

Method Detail

attribute_length

public long attribute_length()
Description copied from class: Attribute
The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.

Specified by:
attribute_length in class Attribute

number_of_exceptions

public int number_of_exceptions()

exception_index_table

public ConstantClass exception_index_table(int i)
Returns the CONSTANT_Class_info corresponding to an entry in the exception_index_table. Returns null if the entry is zero.


write

public void write(ClassDataOutputStream out)
           throws IOException
Write to bytecode stream.

Specified by:
write in class Attribute
Throws:
IOException

print

public void print(PrintWriter pw,
                  int indent)
Pretty-print the contents of this attribute.

Overrides:
print in class Attribute
Parameters:
indent - the indentation level to use.