harpoon.IR.RawClass
Class ConstantString

java.lang.Object
  extended by harpoon.IR.RawClass.Constant
      extended by harpoon.IR.RawClass.ConstantValue
          extended by harpoon.IR.RawClass.ConstantString

public class ConstantString
extends ConstantValue

The CONSTANT_String_info structure is used to represent constant objects of the type java.lang.String.

Version:
$Id: ConstantString.java,v 1.2 2002/02/25 21:05:27 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
"The Java Virtual Machine Specification, section 4.4.3", Constant

Field Summary
 int string_index
          The value of the string_index item must be a valid index into the constant_pool table.
 
Fields inherited from class harpoon.IR.RawClass.Constant
parent
 
Constructor Summary
ConstantString(ClassFile parent, int string_index)
          Constructor.
 
Method Summary
 ConstantUtf8 string_index()
           
 String string()
           
 String toString()
          Create a human-readable representation of this constant.
 Object value()
          Returns the value of this constant, wrapped as a java.lang.String.
 void write(ClassDataOutputStream out)
          Write to a bytecode file.
 
Methods inherited from class harpoon.IR.RawClass.Constant
entrySize, print, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

string_index

public int string_index
The value of the string_index item must be a valid index into the constant_pool table. The constant_pool entry at that point must be a CONSTANT_Utf8_info representing the sequence of characters to which the java.lang.String object is to be initialized.

Constructor Detail

ConstantString

public ConstantString(ClassFile parent,
                      int string_index)
Constructor.

Method Detail

write

public void write(ClassDataOutputStream out)
           throws IOException
Write to a bytecode file.

Specified by:
write in class Constant
Throws:
IOException - on error writing to output stream.

string_index

public ConstantUtf8 string_index()

string

public String string()

value

public Object value()
Returns the value of this constant, wrapped as a java.lang.String.

Specified by:
value in class ConstantValue

toString

public String toString()
Create a human-readable representation of this constant.

Overrides:
toString in class Constant