1 7 8 package org.gjt.jclasslib.structures.attributes; 9 10 import org.gjt.jclasslib.structures.AttributeInfo; 11 import org.gjt.jclasslib.structures.InvalidByteCodeException; 12 13 import java.io.*; 14 15 21 public class SourceFileAttribute extends AttributeInfo { 22 23 24 public static final String ATTRIBUTE_NAME = "SourceFile"; 25 26 private static final int LENGTH = 2; 27 28 private int sourcefileIndex; 29 30 34 public int getSourcefileIndex() { 35 return sourcefileIndex; 36 } 37 38 42 public void setSourcefileIndex(int sourcefileIndex) { 43 this.sourcefileIndex = sourcefileIndex; 44 } 45 46 public void read(DataInput in) 47 throws InvalidByteCodeException, IOException { 48 49 sourcefileIndex = in.readUnsignedShort(); 50 if (debug) debug("read "); 51 } 52 53 public void write(DataOutput out) 54 throws InvalidByteCodeException, IOException { 55 56 super.write(out); 57 out.writeShort(sourcefileIndex); 58 if (debug) debug("wrote "); 59 } 60 61 public int getAttributeLength() { 62 return LENGTH; 63 } 64 65 protected void debug(String message) { 66 super.debug(message + "SourceFile attribute with sourcefile_index " + sourcefileIndex); 67 } 68 69 } 70 | Popular Tags |