APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.classfile

public final Class ExceptionTable

extends Attribute
Class Inheritance
Imports
java.io.DataInput, .DataOutputStream, .IOException, java.util.Arrays, com.sun.org.apache.bcel.internal.Const, com.sun.org.apache.bcel.internal.util.Args, jdk.xml.internal.Utils

This class represents the table of exceptions that are thrown by a method. This attribute may be used once per method. The name of this class is ExceptionTable for historical reasons; The Java Virtual Machine Specification, Second Edition defines this attribute using the name Exceptions (which is inconsistent with the other classes).
Exceptions_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 number_of_exceptions;
  u2 exception_index_table[number_of_exceptions];
}
See Also
Code

Field Summary

Modifier and TypeField and Description
private int[]
Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
constant_poolEMPTY_ARRAYlengthname_indextag

Constructor Summary

AccessConstructor and Description
public
ExceptionTable(final ExceptionTable
Source to copy.
c
)

Initialize from another object.

pack-priv
ExceptionTable(final int
Index in constant pool
nameIndex
,
final int
Content length in bytes
length
,
final DataInput
Input stream
input
,
final ConstantPool
Array of constants
constantPool
)

Constructs object from input stream.

public
ExceptionTable(final int
Index in constant pool
nameIndex
,
final int
Content length in bytes
length
,
final int[]
Table of indices in constant pool
exceptionIndexTable
,
final ConstantPool
Array of constants
constantPool
)

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.

public Attribute
copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns: deep copy of this attribute

public void
dump(final DataOutputStream
Output file stream
file
)

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

Dump exceptions attribute to file stream in binary format.

public int[]
getExceptionIndexTable()

Returns: Array of indices into constant pool of thrown exceptions.

public String[]
getExceptionNames()

Returns: class names of thrown exceptions

public int
getNumberOfExceptions()

Returns: Length of exception table.

public void
setExceptionIndexTable(final int[]
the list of exception indexes Also redefines number_of_exceptions according to table length.
exceptionIndexTable
)

public String

Returns:

String representation, i.e., a list of thrown exceptions.
toString
()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Returns a string representation of the object.

Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
addAttributeReaderclonegetConstantPoolgetLengthgetNamegetNameIndexgetTagprintlnreadAttributereadAttributeremoveAttributeReadersetConstantPoolsetLengthsetNameIndex

Field Detail

exceptionIndexTableback to summary
private int[] exceptionIndexTable

Constructor Detail

ExceptionTableback to summary
public ExceptionTable(final ExceptionTable c)

Initialize from another object. Note that both objects use the same references (shallow copy). Use copy() for a physical copy.

Parameters
c:ExceptionTable

Source to copy.

ExceptionTableback to summary
pack-priv ExceptionTable(final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool) throws IOException

Constructs object from input stream.

Parameters
nameIndex:int

Index in constant pool

length:int

Content length in bytes

input:DataInput

Input stream

constantPool:ConstantPool

Array of constants

Exceptions
IOException:
if an I/O error occurs.
ExceptionTableback to summary
public ExceptionTable(final int nameIndex, final int length, final int[] exceptionIndexTable, final ConstantPool constantPool)
Parameters
nameIndex:int

Index in constant pool

length:int

Content length in bytes

exceptionIndexTable:int[]

Table of indices in constant pool

constantPool:ConstantPool

Array of constants

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
copyback to summary
public Attribute copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns:Attribute

deep copy of this attribute

Annotations
@Override
dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

Dump exceptions attribute to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getExceptionIndexTableback to summary
public int[] getExceptionIndexTable()
Returns:int[]

Array of indices into constant pool of thrown exceptions.

getExceptionNamesback to summary
public String[] getExceptionNames()
Returns:String[]

class names of thrown exceptions

getNumberOfExceptionsback to summary
public int getNumberOfExceptions()
Returns:int

Length of exception table.

setExceptionIndexTableback to summary
public void setExceptionIndexTable(final int[] exceptionIndexTable)
Parameters
exceptionIndexTable:int[]

the list of exception indexes Also redefines number_of_exceptions according to table length.

toStringback to summary
public String toString()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

String representation, i.e., a list of thrown exceptions.

Annotations
@Override