public final class Utf8Constant extends Constant
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
text
Text underlying this constant.
|
Modifier | Constructor and Description |
---|---|
private |
Utf8Constant(java.lang.String text)
Create a new instance of this class, based on the specified text.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o)
This method compares this object to the specified object to determine
the natural ordering among the two.
|
(package private) static Utf8Constant |
create(ConstantPool pool,
java.lang.String text)
Return an instance of this class, either newly created, or retrieved
from the specified constant pool.
|
boolean |
equals(java.lang.Object o)
This method returns true if this object is equal to the specified
object.
|
java.lang.String |
getText()
Return the text underlying this constant.
|
int |
hashCode()
Return the unique hash code for this object.
|
java.lang.String |
toString()
Return the string representation of this constant, primarily for
debugging purposes.
|
protected void |
writeContent(java.io.DataOutput out)
This method writes the text underlying this constant out to the
specified output stream in UTF-8 format.
|
getCpIndex, getWidth, setCpIndex, write
private Utf8Constant(java.lang.String text)
text
- Text which should back this constant.static Utf8Constant create(ConstantPool pool, java.lang.String text)
pool
- Constant pool from which to retrieve instance of this class,
if one with the same underlying text already has been created.text
- Text which should back this constant.public java.lang.String getText()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Another Utf8Constant object to check for equality.protected void writeContent(java.io.DataOutput out) throws java.io.IOException
writeContent
in class Constant
out
- Output stream to which text is written.java.io.IOException
- If error occurs writing to stream.public int compareTo(java.lang.Object o)
compareTo()
method is first called, which sorts the objects according to
the constant types. If this comparison indicates the objects compare
as equal, the underlying text is then compared.compareTo
in interface java.lang.Comparable
compareTo
in class Constant
o
- Another object to compare to this one, presumably another
subclass of Constant
.public java.lang.String toString()
Constant