1 11 package org.eclipse.jdt.internal.core.util; 12 13 import org.eclipse.jdt.core.util.ClassFormatException; 14 import org.eclipse.jdt.core.util.IConstantPool; 15 import org.eclipse.jdt.core.util.IConstantPoolConstant; 16 import org.eclipse.jdt.core.util.IConstantPoolEntry; 17 import org.eclipse.jdt.core.util.ISignatureAttribute; 18 19 22 public class SignatureAttribute extends ClassFileAttribute implements ISignatureAttribute { 23 24 private int signatureIndex; 25 private char[] signature; 26 27 SignatureAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException { 28 super(classFileBytes, constantPool, offset); 29 final int index = u2At(classFileBytes, 6, offset); 30 this.signatureIndex = index; 31 IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index); 32 if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) { 33 throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); 34 } 35 this.signature = constantPoolEntry.getUtf8Value(); 36 } 37 40 public int getSignatureIndex() { 41 return this.signatureIndex; 42 } 43 46 public char[] getSignature() { 47 return this.signature; 48 } 49 } 50 | Popular Tags |