ExceptionsAttributepublic class ExceptionsAttribute extends Attribute Encapsulates the Exceptions attribute of a Java class file. |
Fields Summary |
---|
private int | attributeNameIndexindex into the constant pool table containing the name
of this class | private int | attributeLengthlength of this attribute in bytes | private int | numberOfExceptionsthe number of exceptions represented by this exceptions attribute | private int[] | exceptionIndexTablethe table of exceptions represented by this exceptions attribute |
Constructors Summary |
---|
public ExceptionsAttribute(DataInputStream iStream, int attributeNameIndex, int attributeLength)Constructor. Reads the ExceptionsAttribute attribute from
the class file.
this.attributeNameIndex = attributeNameIndex;
this.attributeLength = attributeLength;
numberOfExceptions = iStream.readUnsignedShort ();
exceptionIndexTable = new int[numberOfExceptions];
for (int lcv = 0; lcv < numberOfExceptions; ++lcv)
exceptionIndexTable[lcv] = iStream.readUnsignedShort ();
|
Methods Summary |
---|
public java.lang.String | toString(ConstantPoolInfo[] constantPool)Returns the ExceptionsAttribute attribute in a nice easy to
read format as a string.
ConstantClassInfo c;
ConstantUtf8Info utf8Info;
String s = new String ("");
utf8Info = (ConstantUtf8Info) constantPool[attributeNameIndex];
s = s + utf8Info.toString ();
for (int lcv = 0; lcv < numberOfExceptions; ++lcv)
{
int index = exceptionIndexTable[lcv];
c = (ConstantClassInfo) constantPool[index];
utf8Info = (ConstantUtf8Info) constantPool[c.getNameIndex ()];
s = s + "\n\t\t\tThrows\t";
s = s + StringParser.parseClassName (utf8Info.toString ());
}
return s;
|
|