KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > types > reflect > ConstantValue


1 package polyglot.types.reflect;
2
3 import java.util.*;
4 import java.io.*;
5
6 /**
7  * The ConstantValue attribute stores an index into the constant pool
8  * that represents constant value. A class's static fields have
9  * constant value attributes.
10  *
11  * @see polyglot.types.reflect Field
12  *
13  * @author Nate Nystrom
14  * (<a HREF="mailto:nystrom@cs.purdue.edu">nystrom@cs.purdue.edu</a>)
15  */

16 class ConstantValue extends Attribute
17 {
18   int index;
19
20   /**
21    * Constructor. Create a ConstantValue attribute from a data stream.
22    *
23    * @param in
24    * The data stream of the class file.
25    * @param nameIndex
26    * The index into the constant pool of the name of the attribute.
27    * @param length
28    * The length of the attribute, excluding the header.
29    * @exception IOException
30    * If an error occurs while reading.
31    */

32   ConstantValue(DataInputStream in, int nameIndex, int length)
33     throws IOException
34   {
35     super(nameIndex, length);
36     index = in.readUnsignedShort();
37   }
38 }
39
Popular Tags