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 SignatureAttribute extends AttributeInfo { 26 29 public static final String tag = "Signature"; 30 31 SignatureAttribute(ConstPool cp, int n, DataInputStream in) 32 throws IOException 33 { 34 super(cp, n, in); 35 } 36 37 43 public SignatureAttribute(ConstPool cp, String signature) { 44 super(cp, tag); 45 int index = cp.addUtf8Info(signature); 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 getSignature() { 56 return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); 57 } 58 59 67 public AttributeInfo copy(ConstPool newCp, Map classnames) { 68 return new SignatureAttribute(newCp, getSignature()); 69 } 70 } 71 | Popular Tags |