1 26 package net.sf.javaguard.classfile; 27 28 import java.io.*; 29 30 31 36 public class LineNumberTableAttrInfo extends AttrInfo { 37 38 private int lineNumberTableLength; 39 40 private LineNumberInfo[] lineNumberTable; 41 42 43 44 45 50 protected LineNumberTableAttrInfo(ClassFile cf, int attrNameIndex, int attrLength) { 51 super(cf, attrNameIndex, attrLength); 52 } 53 54 55 56 57 60 protected String getAttrName() { 61 return ATTR_LineNumberTable; 62 } 63 64 65 66 67 71 protected void setLineNumberTableLength(int len) { 72 this.lineNumberTableLength = len; 73 } 74 75 76 80 protected int getLineNumberTableLength() { 81 return lineNumberTableLength; 82 } 83 84 85 86 87 91 protected void setLineNumberTable(LineNumberInfo[] table) { 92 lineNumberTable = table; 93 } 94 95 96 100 protected LineNumberInfo[] getLineNumberTable() { 101 return lineNumberTable; 102 } 103 104 105 106 107 111 protected void readInfo(DataInput din) 112 throws IOException { 113 setLineNumberTableLength(din.readUnsignedShort()); 114 LineNumberInfo[] table = new LineNumberInfo[getLineNumberTableLength()]; 115 for (int i = 0; i < getLineNumberTableLength(); i++) { 116 table[i] = LineNumberInfo.create(din); 117 } 118 setLineNumberTable(table); 119 } 120 121 122 127 public void writeInfo(DataOutput dout) 128 throws IOException { 129 dout.writeShort(getLineNumberTableLength()); 130 for (int i = 0; i < getLineNumberTableLength(); i++) { 131 getLineNumberTable()[i].write(dout); 132 } 133 } 134 135 136 137 138 142 public void dump(PrintWriter pw, ClassFile cf) { 143 pw.println(getAttrName()); 144 pw.print("Number of entries: "); 145 pw.println(getLineNumberTableLength()); 146 for (int i=0; i<getLineNumberTableLength(); i++) { 147 getLineNumberTable()[i].dump(pw, cf); 148 } 149 } 150 } 151 | Popular Tags |