01: /*
02: * RuntimeVisibleAnnotationsAttrInfo.java
03: *
04: * Created on April 20, 2005, 11:51 AM
05: */
06:
07: package com.yworks.yguard.obf.classfile;
08:
09: import java.io.DataInput;
10: import java.io.DataOutput;
11: import java.io.IOException;
12:
13: /**
14: *
15: * @author muellese
16: */
17: public class RuntimeVisibleAnnotationsAttrInfo extends AttrInfo {
18: private int u2AnnotationCount;
19: private AnnotationInfo[] annotations;
20:
21: /** Creates a new instance of RuntimeVisibleAnnotationsAttrInfo */
22: public RuntimeVisibleAnnotationsAttrInfo(ClassFile cf,
23: int attrNameIndex, int attrLength) {
24: super (cf, attrNameIndex, attrLength);
25: }
26:
27: protected String getAttrName() {
28: return ClassConstants.ATTR_RuntimeVisibleAnnotations;
29: }
30:
31: protected AnnotationInfo[] getAnnotations() {
32: return annotations;
33: }
34:
35: public void writeInfo(java.io.DataOutput dout)
36: throws java.io.IOException {
37: dout.writeShort(u2AnnotationCount);
38: for (int i = 0; i < u2AnnotationCount; i++) {
39: annotations[i].write(dout);
40: }
41: }
42:
43: protected void readInfo(java.io.DataInput din)
44: throws java.io.IOException {
45: u2AnnotationCount = din.readUnsignedShort();
46: annotations = new AnnotationInfo[u2AnnotationCount];
47: for (int i = 0; i < u2AnnotationCount; i++) {
48: annotations[i] = AnnotationInfo.create(din);
49: }
50: }
51:
52: protected void markUtf8RefsInInfo(ConstantPool pool) {
53: for (int i = 0; i < u2AnnotationCount; i++) {
54: annotations[i].markUtf8RefsInInfo(pool);
55: }
56: }
57: }
|