1 15 16 package javassist.bytecode; 17 18 import java.io.DataInputStream ; 19 import java.io.IOException ; 20 import java.util.Map ; 21 22 25 public class SourceFileAttribute extends AttributeInfo { 26 29 public static final String tag = "SourceFile"; 30 31 SourceFileAttribute(ConstPool cp, int n, DataInputStream in) 32 throws IOException 33 { 34 super(cp, n, in); 35 } 36 37 43 public SourceFileAttribute(ConstPool cp, String filename) { 44 super(cp, tag); 45 int index = cp.addUtf8Info(filename); 46 byte[] bvalue = new byte[2]; 47 bvalue[0] = (byte)(index >>> 8); 48 bvalue[1] = (byte)index; 49 set(bvalue); 50 } 51 52 55 public String getFileName() { 56 return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); 57 } 58 59 67 public AttributeInfo copy(ConstPool newCp, Map classnames) { 68 return new SourceFileAttribute(newCp, getFileName()); 69 } 70 } 71 | Popular Tags |