KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * ParameterAnnotationInfo.java
3  *
4  * Created on April 20, 2005, 4:27 PM
5  */

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

16 public class ParameterAnnotationInfo
17 {
18   
19   // Constants -------------------------------------------------------------
20

21   
22   // Fields ----------------------------------------------------------------
23
private int u2annotationCount;
24   private AnnotationInfo[] annotations;
25   
26   
27   // Class Methods ---------------------------------------------------------
28
public static ParameterAnnotationInfo create(DataInput JavaDoc din) throws java.io.IOException JavaDoc
29   {
30     if (din == null) throw new NullPointerException JavaDoc("DataInput cannot be null!");
31     ParameterAnnotationInfo an = new ParameterAnnotationInfo();
32     an.read(din);
33     return an;
34   }
35   
36   // Instance Methods ------------------------------------------------------
37
private ParameterAnnotationInfo()
38   {}
39   
40   protected AnnotationInfo[] getAnnotations(){
41     return annotations;
42   }
43   
44   protected void markUtf8RefsInInfo(ConstantPool pool) {
45     for (int i = 0; i < u2annotationCount; i++){
46       annotations[i].markUtf8RefsInInfo(pool);
47     }
48   }
49
50   
51   private void read(DataInput JavaDoc din) throws java.io.IOException JavaDoc
52   {
53     u2annotationCount = din.readUnsignedShort();
54     annotations = new AnnotationInfo[u2annotationCount];
55     for (int i = 0; i < u2annotationCount; i++)
56     {
57       annotations[i] = AnnotationInfo.create(din);
58     }
59   }
60   
61   /** Export the representation to a DataOutput stream. */
62   public void write(DataOutput JavaDoc dout) throws java.io.IOException JavaDoc
63   {
64     dout.writeShort(u2annotationCount);
65     for (int i = 0; i < u2annotationCount; i++)
66     {
67       annotations[i].write(dout);
68     }
69   }
70 }
71
Popular Tags