01: /*
02: * ParameterAnnotationInfo.java
03: *
04: * Created on April 20, 2005, 4:27 PM
05: */
06:
07: package com.yworks.yguard.obf.classfile;
08:
09: import java.io.DataInput;
10: import java.io.DataOutput;
11:
12: /**
13: *
14: * @author muellese
15: */
16: public class ParameterAnnotationInfo {
17:
18: // Constants -------------------------------------------------------------
19:
20: // Fields ----------------------------------------------------------------
21: private int u2annotationCount;
22: private AnnotationInfo[] annotations;
23:
24: // Class Methods ---------------------------------------------------------
25: public static ParameterAnnotationInfo create(DataInput din)
26: throws java.io.IOException {
27: if (din == null)
28: throw new NullPointerException("DataInput cannot be null!");
29: ParameterAnnotationInfo an = new ParameterAnnotationInfo();
30: an.read(din);
31: return an;
32: }
33:
34: // Instance Methods ------------------------------------------------------
35: private ParameterAnnotationInfo() {
36: }
37:
38: protected AnnotationInfo[] getAnnotations() {
39: return annotations;
40: }
41:
42: protected void markUtf8RefsInInfo(ConstantPool pool) {
43: for (int i = 0; i < u2annotationCount; i++) {
44: annotations[i].markUtf8RefsInInfo(pool);
45: }
46: }
47:
48: private void read(DataInput din) throws java.io.IOException {
49: u2annotationCount = din.readUnsignedShort();
50: annotations = new AnnotationInfo[u2annotationCount];
51: for (int i = 0; i < u2annotationCount; i++) {
52: annotations[i] = AnnotationInfo.create(din);
53: }
54: }
55:
56: /** Export the representation to a DataOutput stream. */
57: public void write(DataOutput dout) throws java.io.IOException {
58: dout.writeShort(u2annotationCount);
59: for (int i = 0; i < u2annotationCount; i++) {
60: annotations[i].write(dout);
61: }
62: }
63: }
|