01: /* ===========================================================================
02: * $RCSfile: ExceptionInfo.java,v $
03: * ===========================================================================
04: *
05: * RetroGuard -- an obfuscation package for Java classfiles.
06: *
07: * Copyright (c) 1998-2006 Mark Welsh (markw@retrologic.com)
08: *
09: * This program can be redistributed and/or modified under the terms of the
10: * Version 2 of the GNU General Public License as published by the Free
11: * Software Foundation.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: */
19:
20: package COM.rl.obf.classfile;
21:
22: import java.io.*;
23: import java.util.*;
24:
25: /**
26: * Representation of an Exception table entry.
27: *
28: * @author Mark Welsh
29: */
30: public class ExceptionInfo {
31: // Constants -------------------------------------------------------------
32: public static final int CONSTANT_FIELD_SIZE = 8;
33:
34: // Fields ----------------------------------------------------------------
35: private int u2startpc;
36: private int u2endpc;
37: private int u2handlerpc;
38: private int u2catchType;
39:
40: // Class Methods ---------------------------------------------------------
41: public static ExceptionInfo create(DataInput din) throws Exception {
42: ExceptionInfo ei = new ExceptionInfo();
43: ei.read(din);
44: return ei;
45: }
46:
47: // Instance Methods ------------------------------------------------------
48: private ExceptionInfo() {
49: }
50:
51: private void read(DataInput din) throws Exception {
52: u2startpc = din.readUnsignedShort();
53: u2endpc = din.readUnsignedShort();
54: u2handlerpc = din.readUnsignedShort();
55: u2catchType = din.readUnsignedShort();
56: }
57:
58: /** Export the representation to a DataOutput stream. */
59: public void write(DataOutput dout) throws Exception {
60: dout.writeShort(u2startpc);
61: dout.writeShort(u2endpc);
62: dout.writeShort(u2handlerpc);
63: dout.writeShort(u2catchType);
64: }
65: }
|