| 1 26 package net.sf.javaguard.classfile; 27 28 import java.io.*; 29 30 31 36 public class LineNumberInfo { 37 38 private int startPc; 39 40 private int lineNumber; 41 42 43 44 45 50 public static LineNumberInfo create(DataInput din) 51 throws IOException { 52 LineNumberInfo lni = new LineNumberInfo(); 53 lni.read(din); 54 return lni; 55 } 56 57 58 59 60 62 private LineNumberInfo() { 63 } 64 65 66 67 68 72 protected void setStartPc(int pc) { 73 this.startPc = pc; 74 } 75 76 77 81 protected int getStartPc() { 82 return startPc; 83 } 84 85 86 87 88 92 protected void setLineNumber(int num) { 93 lineNumber = num; 94 } 95 96 97 101 protected int getLineNumber() { 102 return lineNumber; 103 } 104 105 106 107 108 112 private void read(DataInput din) 113 throws IOException { 114 setStartPc(din.readUnsignedShort()); 115 setLineNumber(din.readUnsignedShort()); 116 } 117 118 119 123 public void write(DataOutput dout) 124 throws IOException { 125 dout.writeShort(getStartPc()); 126 dout.writeShort(getLineNumber()); 127 } 128 129 130 131 132 136 public void dump(PrintWriter pw, ClassFile cf) { 137 pw.print("StartPC: "); 138 pw.println(getStartPc()); 139 pw.print("Line number: "); 140 pw.println(getLineNumber()); 141 } 142 } 143 | Popular Tags |