| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package org.apache.commons.compress.harmony.unpack200.bytecode; |
| 20 |
|
| 21 |
import java.io.DataOutputStream; |
| 22 |
import java.io.IOException; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public class SignatureAttribute extends Attribute { |
| 28 |
|
| 29 |
private static CPUTF8 attributeName; |
| 30 |
|
| 31 |
public static void setAttributeName(final CPUTF8 cpUTF8Value) { |
| 32 |
attributeName = cpUTF8Value; |
| 33 |
} |
| 34 |
|
| 35 |
private int signatureIndex; |
| 36 |
|
| 37 |
private final CPUTF8 signature; |
| 38 |
|
| 39 |
public SignatureAttribute(final CPUTF8 value) { |
| 40 |
super(attributeName); |
| 41 |
this.signature = value; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
@Override |
| 50 |
protected int getLength() { |
| 51 |
return 2; |
| 52 |
} |
| 53 |
|
| 54 |
@Override |
| 55 |
protected ClassFileEntry[] getNestedClassFileEntries() { |
| 56 |
return new ClassFileEntry[] { getAttributeName(), signature }; |
| 57 |
} |
| 58 |
|
| 59 |
@Override |
| 60 |
protected void resolve(final ClassConstantPool pool) { |
| 61 |
super.resolve(pool); |
| 62 |
signature.resolve(pool); |
| 63 |
signatureIndex = pool.indexOf(signature); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
@Override |
| 72 |
public String toString() { |
| 73 |
|
| 74 |
return "Signature: " + signature; |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
@Override |
| 83 |
protected void writeBody(final DataOutputStream dos) throws IOException { |
| 84 |
dos.writeShort(signatureIndex); |
| 85 |
} |
| 86 |
|
| 87 |
} |