|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.java.Constant
This class represents an entry in the constant pool table of a class file.
Field Summary | |
static byte |
CLASS
Constant representing the constant pool entry type CLASS. |
static byte |
DOUBLE
Constant representing the constant pool entry type DOUBLE. |
static byte |
FIELD_REF
Constant representing the constant pool entry type FIELD_REF. |
static byte |
FLOAT
Constant representing the constant pool entry type FLOAT. |
static byte |
INTEGER
Constant representing the constant pool entry type INTEGER. |
static byte |
INTERFACE_METHOD_REF
Constant representing the constant pool entry type INTERFACE_METHOD_REF. |
static byte |
LONG
Constant representing the constant pool entry type LONG. |
static byte |
METHOD_REF
Constant representing the constant pool entry type METHOD_REF. |
static byte |
NAME_AND_TYPE
Constant representing the constant pool entry type NAME_AND_TYPE. |
static byte |
STRING
Constant representing the constant pool entry type STRING. |
static byte |
UTF8
Constant representing the constant pool entry type UTF8. |
Constructor Summary | |
Constant(byte tp,
int i1)
Constructs a new constant pool entry of type CLASS or STRING. |
|
Constant(byte tp,
int i1,
int i2)
Constructs a new constant pool entry describing a field, method or name and type. |
|
Constant(java.io.DataInputStream in)
Constructs a new constant pool entry by reading data from the given stream. |
|
Constant(double d)
Constructs a constant pool entry of type DOUBLE. |
|
Constant(float f)
Constructs a constant pool entry of type FLOAT. |
|
Constant(int i)
Constructs a constant pool entry of type INTEGER. |
|
Constant(long l)
Constructs a constant pool entry of type LONG. |
|
Constant(java.lang.String data)
Constructs a new UTF8 constant pool entry with a specified value. |
Method Summary | |
boolean |
equals(java.lang.Object o)
Compares this Constant object to another for equality. |
double |
getDoubleValue()
Returns the double value of a this constant. |
float |
getFloatValue()
Returns the float value of a this constant. |
int |
getIndex1()
Returns the value of the first contant pool index. |
int |
getIndex2()
Returns the value of the second contant pool index. |
int |
getIntegerValue()
Returns the int value of a this constant. |
long |
getLongValue()
Returns the long value of a this constant. |
byte |
getType()
Returns the type code for this constant pool entry. |
java.lang.String |
getUTF()
Returns the string contained in this constant if it is of type UTF8. |
void |
printData(java.io.PrintStream out)
Writes textual information about the class represented by this Constant object to the specified destination. |
void |
writeTo(java.io.DataOutputStream out)
Writes a constant to the specified stream in the format required by the Java Virtual Machine Specification. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final byte UTF8
public static final byte INTEGER
public static final byte FLOAT
public static final byte LONG
public static final byte DOUBLE
public static final byte CLASS
public static final byte STRING
public static final byte FIELD_REF
public static final byte METHOD_REF
public static final byte INTERFACE_METHOD_REF
public static final byte NAME_AND_TYPE
Constructor Detail |
public Constant(java.lang.String data)
data
- the string value for the new constant.public Constant(int i)
i
- the value of the new constant.public Constant(long l)
l
- the value of the new constant.public Constant(float f)
f
- the value of the new constant.public Constant(double d)
d
- the value of the new constant.public Constant(byte tp, int i1)
tp
- the type of the new constant pool entry, either STRING or CLASS.i1
- the index of the UTF8 entry describing this constant.public Constant(byte tp, int i1, int i2)
tp
parameter may be one of: FIELD_REF,
METHOD_REF, INTERFACE_METHOD_REF, or NAME_AND_TYPE.tp
- the type of the new constant pool entry.i1
- the index of an associated constant, either a CLASS or a UTF8.i2
- the index of an associated constant, either a NAME_AND_TYPE or a
UTF8.public Constant(java.io.DataInputStream in) throws java.io.IOException
in
- the stream from which to read the constant pool entry.Method Detail |
public byte getType()
public java.lang.String getUTF()
public int getIntegerValue()
int
value of a this constant.int
value of a this constant.public long getLongValue()
long
value of a this constant.long
value of a this constant.public float getFloatValue()
float
value of a this constant.float
value of a this constant.public double getDoubleValue()
double
value of a this constant.double
value of a this constant.public int getIndex1()
public int getIndex2()
public boolean equals(java.lang.Object o)
o
- the object to compare this Constant to.public void writeTo(java.io.DataOutputStream out) throws java.io.IOException
out
- a destination stream to write the classfile data to.public void printData(java.io.PrintStream out)
out
- a PrintStream connected to the desired destination.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |