FileDocCategorySizeDatePackage
ExceptionsAttribute.javaAPI DocGlassfish v2 API4101Fri May 04 22:34:28 BST 2007com.sun.jdo.api.persistence.enhancer.classfile

ExceptionsAttribute

public class ExceptionsAttribute extends ClassAttribute
ExceptionsAttribute represents a method attribute in a class file listing the checked exceptions for the method.

Fields Summary
public static final String
expectedAttrName
private Vector
exceptionTable
Constructors Summary
public ExceptionsAttribute(ConstUtf8 attrName, Vector excTable)
Constructor

    super(attrName);
    exceptionTable = excTable;
  
public ExceptionsAttribute(ConstUtf8 attrName, ConstClass exc)
Convenience Constructor - for single exception

    super(attrName);
    exceptionTable = new Vector(1);
    exceptionTable.addElement(exc);
  
Methods Summary
public java.util.Enumerationexceptions()
Return an enumeration of the checked exceptions


  /* public accessors */

             
     
    return exceptionTable.elements();
  
voidprint(java.io.PrintStream out, int indent)

    ClassPrint.spaces(out, indent);
    out.print("Exceptions:");//NOI18N
    for (int i=0; i<exceptionTable.size(); i++)
        out.print(" " + ((ConstClass) exceptionTable.elementAt(i)).asString());//NOI18N
    out.println();
  
static com.sun.jdo.api.persistence.enhancer.classfile.ExceptionsAttributeread(ConstUtf8 attrName, java.io.DataInputStream data, ConstantPool pool)

    int nExcepts = data.readUnsignedShort();
    Vector excTable = new Vector();
    while (nExcepts-- > 0) {
      int excIndex = data.readUnsignedShort();
      ConstClass exc_class = null;
      if (excIndex != 0)
	exc_class = (ConstClass) pool.constantAt(excIndex);
      excTable.addElement(exc_class);
    }
        
    return new ExceptionsAttribute(attrName, excTable);
  
voidwrite(java.io.DataOutputStream out)

    out.writeShort(attrName().getIndex());
    out.writeInt(2+2*exceptionTable.size());
    out.writeShort(exceptionTable.size());
    for (int i=0; i<exceptionTable.size(); i++)
      out.writeShort(((ConstClass) exceptionTable.elementAt(i)).getIndex());