1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.*; 28 import java.util.Vector ; 29 import java.util.Enumeration ; 30 31 35 36 public class ExceptionTable { 37 38 private Vector theVector = new Vector (); 39 40 41 42 46 public Enumeration handlers() { 47 return theVector.elements(); 48 } 49 50 53 public void addElement(ExceptionRange range) { 54 theVector.addElement(range); 55 } 56 57 public ExceptionTable() { } 58 59 60 61 static ExceptionTable read(DataInputStream data, CodeEnv env) 62 throws IOException { 63 ExceptionTable excTable = new ExceptionTable(); 64 int nExcepts = data.readUnsignedShort(); 65 while (nExcepts-- > 0) { 66 excTable.addElement(ExceptionRange.read(data, env)); 67 } 68 return excTable; 69 } 70 71 void write(DataOutputStream out) throws IOException { 72 out.writeShort(theVector.size()); 73 for (int i=0; i<theVector.size(); i++) 74 ((ExceptionRange) theVector.elementAt(i)).write(out); 75 } 76 77 void print(PrintStream out, int indent) { 78 ClassPrint.spaces(out, indent); 79 out.println("Exception Table: "); for (int i=0; i<theVector.size(); i++) 81 ((ExceptionRange) theVector.elementAt(i)).print(out, indent+2); 82 } 83 } 84 85 86 87 | Popular Tags |