1 26 package net.sf.javaguard.classfile; 27 28 import java.io.*; 29 30 31 36 public class ExceptionInfo { 37 38 public static final int CONSTANT_FIELD_SIZE = 8; 39 40 41 private int startPc; 42 43 private int endPc; 44 45 private int handlerPc; 46 47 private int catchType; 48 49 50 51 52 57 public static ExceptionInfo create(DataInput din) 58 throws IOException { 59 ExceptionInfo ei = new ExceptionInfo(); 60 ei.read(din); 61 return ei; 62 } 63 64 65 66 67 69 private ExceptionInfo() { 70 } 71 72 73 74 75 79 protected void setStartPc(int value) { 80 startPc = value; 81 } 82 83 84 88 protected int getStartPc() { 89 return startPc; 90 } 91 92 93 94 95 99 protected void setEndPc(int value) { 100 endPc = value; 101 } 102 103 104 108 protected int getEndPc() { 109 return endPc; 110 } 111 112 113 114 115 119 protected void setHandlerPc(int value) { 120 handlerPc = value; 121 } 122 123 124 128 protected int getHandlerPc() { 129 return handlerPc; 130 } 131 132 133 134 135 139 protected void setCatchType(int value) { 140 catchType = value; 141 } 142 143 144 148 protected int getCatchType() { 149 return catchType; 150 } 151 152 153 154 155 159 private void read(DataInput din) 160 throws IOException { 161 setStartPc(din.readUnsignedShort()); 162 setEndPc(din.readUnsignedShort()); 163 setHandlerPc(din.readUnsignedShort()); 164 setCatchType(din.readUnsignedShort()); 165 } 166 167 168 173 public void write(DataOutput dout) 174 throws IOException { 175 dout.writeShort(getStartPc()); 176 dout.writeShort(getEndPc()); 177 dout.writeShort(getHandlerPc()); 178 dout.writeShort(getCatchType()); 179 } 180 181 182 183 184 188 public void dump(PrintWriter pw, ClassFile cf) { 189 pw.print("startPC: "); 190 pw.println(getStartPc()); 191 pw.print("endPc: "); 192 pw.println(getEndPc()); 193 pw.print("handlerPc: "); 194 pw.println(getHandlerPc()); 195 pw.print("catchType: "); 196 pw.println(getCatchType()); 197 } 198 } 199 | Popular Tags |