import java.io.*; public class ExceptionsAttribute { int nameIndex; int[] exceptions; public ExceptionsAttribute(AttributeInfo ai) throws IOException { nameIndex = ai.nameIndex(); ByteArrayInputStream bis = new ByteArrayInputStream(ai.data); DataInputStream dis = new DataInputStream(bis); exceptions = new int[dis.readUnsignedShort()]; for (int i = 0; i < exceptions.length; i++) { exceptions[i] = dis.readUnsignedShort(); } } public int nameIndex() { return nameIndex; } public int howMany() { return exceptions.length; } public int getIndex(int i) { return exceptions[i]; } public String toString() { return String.valueOf(nameIndex); } }