edu.wisc.cs.java
Class FieldInfo

java.lang.Object
  |
  +--edu.wisc.cs.java.Accessible
        |
        +--edu.wisc.cs.java.FieldInfo

public class FieldInfo
extends Accessible

This object maintains a Field_Info table, as specified by the Java Virtual Machine specification for class files.


Field Summary
protected  AttributeInfo[] attributes
          An array of sttributes for this field.
protected  ConstantPool cpool
          The constant pool to which this FieldInfo refers.
protected  int descriptor_index
          The index in the constant pool of the descriptor (type) of this field.
protected  int name_index
          The index in the constant pool of the name of this field.
 
Fields inherited from class edu.wisc.cs.java.Accessible
ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ACC_SYNCHRONIZED, ACC_TRANSIENT, ACC_VOLATILE, access_flags
 
Constructor Summary
FieldInfo(ConstantPool cp, int access, java.lang.String name, java.lang.String desc)
          Constructs a new field with the specified access flags, name, and type.
FieldInfo(java.io.DataInputStream in, ConstantPool cp)
          Construct a new FieldInfo object, reading data from the specified stream.
 
Method Summary
 int getDescriptor()
          Returns the index of the descriptor of this field in the constant pool.
 int getName()
          Returns the index of the name of this field in the constant pool.
 void writeTo(java.io.DataOutputStream out)
          Writes a field to the specified stream.
 
Methods inherited from class edu.wisc.cs.java.Accessible
getFlag, setFlag, unSetFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cpool

protected ConstantPool cpool
The constant pool to which this FieldInfo refers.

name_index

protected int name_index
The index in the constant pool of the name of this field.

descriptor_index

protected int descriptor_index
The index in the constant pool of the descriptor (type) of this field.

attributes

protected AttributeInfo[] attributes
An array of sttributes for this field.
Constructor Detail

FieldInfo

public FieldInfo(java.io.DataInputStream in,
                 ConstantPool cp)
          throws java.io.IOException
Construct a new FieldInfo object, reading data from the specified stream.
Parameters:
in - the stream from which to read the data.
cp - the constant pool to which indeces refer.
Throws:
java.io.IOException - if there is a problem reading from the stream.

FieldInfo

public FieldInfo(ConstantPool cp,
                 int access,
                 java.lang.String name,
                 java.lang.String desc)
Constructs a new field with the specified access flags, name, and type. The ConstantPool is expected to be the constant pool for the class which the new field will be a member of. Note that this constructor will modify this constant pool if necessary.
Parameters:
cp - the constant pool for the class of which this field is a member.
access - the access flags for the field.
name - the name of the field.
desc - the type for this field.
See Also:
Accessible
Method Detail

getName

public int getName()
Returns the index of the name of this field in the constant pool.
Returns:
the index of the name of this field in the constant pool.

getDescriptor

public int getDescriptor()
Returns the index of the descriptor of this field in the constant pool.
Returns:
the index of the descriptor of this field in the constant pool.

writeTo

public void writeTo(java.io.DataOutputStream out)
             throws java.io.IOException
Writes a field to the specified stream. The format of the data written is the format required by the Java Virtual Machine specification.
Parameters:
out - the destination stream to write data to.
Throws:
java.io.IOException - if there is a problem writing the field data.