KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > yworks > yguard > obf > classfile > RuntimeVisibleAnnotationsAttrInfo


1 /*
2  * RuntimeVisibleAnnotationsAttrInfo.java
3  *
4  * Created on April 20, 2005, 11:51 AM
5  */

6
7 package com.yworks.yguard.obf.classfile;
8
9 import java.io.DataInput JavaDoc;
10 import java.io.DataOutput JavaDoc;
11 import java.io.IOException JavaDoc;
12
13 /**
14  *
15  * @author muellese
16  */

17 public class RuntimeVisibleAnnotationsAttrInfo extends AttrInfo
18 {
19   private int u2AnnotationCount;
20   private AnnotationInfo[] annotations;
21   
22   /** Creates a new instance of RuntimeVisibleAnnotationsAttrInfo */
23   public RuntimeVisibleAnnotationsAttrInfo(ClassFile cf, int attrNameIndex, int attrLength)
24   {
25     super(cf, attrNameIndex, attrLength);
26   }
27
28   protected String JavaDoc getAttrName()
29   {
30     return ClassConstants.ATTR_RuntimeVisibleAnnotations;
31   }
32   
33   protected AnnotationInfo[] getAnnotations(){
34     return annotations;
35   }
36
37   public void writeInfo(java.io.DataOutput JavaDoc dout) throws java.io.IOException JavaDoc
38   {
39     dout.writeShort(u2AnnotationCount);
40     for (int i = 0; i < u2AnnotationCount; i++){
41       annotations[i].write(dout);
42     }
43   }
44
45   protected void readInfo(java.io.DataInput JavaDoc din) throws java.io.IOException JavaDoc
46   {
47     u2AnnotationCount = din.readUnsignedShort();
48     annotations = new AnnotationInfo[u2AnnotationCount];
49     for (int i = 0; i < u2AnnotationCount; i++){
50       annotations[i] = AnnotationInfo.create(din);
51     }
52   }
53
54     protected void markUtf8RefsInInfo(ConstantPool pool) {
55       for (int i = 0; i < u2AnnotationCount; i++){
56         annotations[i].markUtf8RefsInInfo(pool);
57       }
58     }
59 }
60
Popular Tags