public final class ConstantStringInfo extends CPInfo
ConstantStringInfo
denotes a CONSTANT_String_info structure in the constant_pool of a ClassFile structure.
The CONSTANT_String_info structure was added to Java in version 1.0.2.
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the CONSTANT_String_info structure.
|
static int |
TAG
The tag for CONSTANT_String.
|
Modifier and Type | Method and Description |
---|---|
ConstantStringInfo |
copy()
Returns a copy of this
ConstantStringInfo instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of ConstantStringInfo , and that ConstantStringInfo instance is equal to this ConstantStringInfo instance, false
otherwise. |
static java.util.List<ConstantStringInfo> |
filter(Node node)
Returns a
List with all ConstantStringInfo s. |
int |
getStringIndex()
Returns the string_index of this
ConstantStringInfo instance. |
int |
hashCode()
Returns a hash code for this
ConstantStringInfo instance. |
static ConstantStringInfo |
newInstance(int stringIndex)
Returns a new
ConstantStringInfo . |
void |
setStringIndex(int stringIndex)
Sets a new string_index for this
ConstantStringInfo instance. |
java.lang.String |
toString()
Returns a
String representation of this ConstantStringInfo instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
ConstantStringInfo to dataOutput . |
void |
write(Document document)
Writes this
ConstantStringInfo to document . |
getConstantPoolEntryCount, getName, getTag
public static final java.lang.String NAME
public static final int TAG
public ConstantStringInfo copy()
ConstantStringInfo
instance.public java.lang.String toString()
String
representation of this ConstantStringInfo
instance.toString
in class java.lang.Object
String
representation of this ConstantStringInfo
instancepublic boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of ConstantStringInfo
, and that ConstantStringInfo
instance is equal to this ConstantStringInfo
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this ConstantStringInfo
instance for equalitytrue
if, and only if, object
is an instance of ConstantStringInfo
, and that ConstantStringInfo
instance is equal to this ConstantStringInfo
instance, false
otherwisepublic int getStringIndex()
ConstantStringInfo
instance.ConstantStringInfo
instancepublic int hashCode()
ConstantStringInfo
instance.hashCode
in class java.lang.Object
ConstantStringInfo
instancepublic void setStringIndex(int stringIndex)
ConstantStringInfo
instance.
If stringIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
stringIndex
- the new string_index for this ConstantStringInfo
instancejava.lang.IllegalArgumentException
- thrown if, and only if, stringIndex
is less than or equal to 0
public void write(java.io.DataOutput dataOutput)
ConstantStringInfo
to dataOutput
.
If dataOutput
is an OutputStream
(or any other type of stream), this method will not close it.
If dataOutput
is null
, a NullPointerException
will be thrown.
If an I/O-error occurs, an UncheckedIOException
will be thrown.
public void write(Document document)
ConstantStringInfo
to document
.
If document
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
public static ConstantStringInfo newInstance(int stringIndex)
ConstantStringInfo
.
If stringIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
stringIndex
- the string_index of the new ConstantStringInfo
instanceConstantStringInfo
java.lang.IllegalArgumentException
- thrown if, and only if, stringIndex
is less than or equal to 0
public static java.util.List<ConstantStringInfo> filter(Node node)
List
with all ConstantStringInfo
s.
All ConstantStringInfo
s are found by traversing node
using a simple NodeHierarchicalVisitor
implementation.
If node
is null
, a NullPointerException
will be thrown.
node
- the Node
to start traversal fromList
with all ConstantStringInfo
sjava.lang.NullPointerException
- thrown if, and only if, node
is null