/** * Reads an attribute for this method from the specified input stream. * * @param in The input stream to read from. * @return The attribute read, possibly <code>null</code> if it was known to be unimportant for * our purposes. * @throws IOException If an IO error occurs. */ private AttributeInfo readAttribute(DataInputStream in) throws IOException { AttributeInfo ai = null; int attributeNameIndex = in.readUnsignedShort(); int attributeLength = in.readInt(); String attrName = cf.getUtf8ValueFromConstantPool(attributeNameIndex); if (CODE.equals(attrName)) { // 4.7.3 ai = Code.read(this, in); } else if (EXCEPTIONS.equals(attrName)) { // 4.7.4 int exceptionCount = in.readUnsignedShort(); int[] exceptionIndexTable = null; if (exceptionCount > 0) { exceptionIndexTable = new int[exceptionCount]; for (int i = 0; i < exceptionCount; i++) { exceptionIndexTable[i] = in.readUnsignedShort(); } } Exceptions e = new Exceptions(this, exceptionIndexTable); ai = e; } // TODO: Handle other Attribute types. // Attributes common to all members, or unhandled attributes. else { ai = super.readAttribute(in, attrName, attributeLength); // if (ai!=null) { // "Deprecated" attribute returns null // System.out.println("-------------- " + ai.getName()); // } } return ai; }