1 7 8 package org.gjt.jclasslib.structures.attributes; 9 10 import org.gjt.jclasslib.structures.*; 11 12 import java.io.*; 13 14 20 public class LineNumberTableEntry extends AbstractStructure { 21 22 25 public static final int LENGTH = 4; 26 27 private int startPc; 28 private int lineNumber; 29 30 40 public static LineNumberTableEntry create(DataInput in, ClassFile classFile) 41 throws InvalidByteCodeException, IOException { 42 43 LineNumberTableEntry lineNumberTableEntry = new LineNumberTableEntry(); 44 lineNumberTableEntry.setClassFile(classFile); 45 lineNumberTableEntry.read(in); 46 47 return lineNumberTableEntry; 48 } 49 50 55 public int getStartPc() { 56 return startPc; 57 } 58 59 64 public void setStartPc(int startPc) { 65 this.startPc = startPc; 66 } 67 68 73 public int getLineNumber() { 74 return lineNumber; 75 } 76 77 82 public void setLineNumber(int lineNumber) { 83 this.lineNumber = lineNumber; 84 } 85 86 public void read(DataInput in) 87 throws InvalidByteCodeException, IOException { 88 89 startPc = in.readUnsignedShort(); 90 lineNumber = in.readUnsignedShort(); 91 92 if (debug) debug("read "); 93 } 94 95 public void write(DataOutput out) 96 throws InvalidByteCodeException, IOException { 97 98 super.write(out); 99 out.writeShort(startPc); 100 out.writeShort(lineNumber); 101 if (debug) debug("wrote "); 102 } 103 104 protected void debug(String message) { 105 super.debug(message + "LineNumberTable entry with start_pc " + startPc + 106 ", line_number " + lineNumber); 107 } 108 109 protected String printAccessFlagsVerbose(int accessFlags) { 110 if (accessFlags != 0) 111 throw new RuntimeException ("Access flags should be zero: " + Integer.toHexString(accessFlags)); 112 return ""; 113 } 114 115 } 116 | Popular Tags |