CONSTANT_Utf8_info or CONSTANT_String_info.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteArray | bytes
|
| public static final CstString | EMPTY_STRING
|
| private final String | string
|
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected int | compareTo0(Constant
non-null; the instance to compare toImplements abstract org. |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public ByteArray | Returns: non-null; an array of the UTF-8 bytesGets the UTF-8 value as UTF-8 encoded bytes. |
| public String | |
| public Type | getType()
Implements org. |
| public int | |
| public int | |
| public int | |
| public boolean | isCategory2()
Implements abstract org. true if this instance is a category-2 constant,
meaning it takes up two slots in the constant pool, or
false if this instance is category-1.
|
| public static byte[] | Returns: non-null; the UTF-8 bytes for itnon-null; the string to convertConverts a string into its MUTF-8 form. |
| private static String | Returns: neverthe byte value value, int the file offset offset)Helper for |
| public String | toHuman()
Implements org. |
| public String | Returns: non-null; the quoted stringGets the value as a human-oriented string, surrounded by double quotes. |
| public String | Returns: non-null; the quoted string>= 5; the maximum length of the string to returnGets the value as a human-oriented string, surrounded by double quotes, but ellipsizes the result if it is longer than the given maximum length |
| public String | |
| public String | typeName()
Implements abstract org. |
| public static String | Returns: non-null; the converted stringnon-null; the bytes to convertConverts an array of UTF-8 bytes into a string. |
| bytes | back to summary |
|---|---|
| private final ByteArray bytes
| |
| EMPTY_STRING | back to summary |
|---|---|
| public static final CstString EMPTY_STRING
| |
| string | back to summary |
|---|---|
| private final String string
| |
| CstString | back to summary |
|---|---|
| public CstString(String string) Constructs an instance from a
| |
| CstString | back to summary |
|---|---|
| public CstString(ByteArray bytes) Constructs an instance from some UTF-8 bytes.
| |
| compareTo0 | back to summary |
|---|---|
| protected int compareTo0(Constant other) Implements abstract org. Doc from org. Compare the values of this and another instance, which are guaranteed to be of the same class. Subclasses must implement this. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getBytes | back to summary |
|---|---|
| public ByteArray getBytes() Gets the UTF-8 value as UTF-8 encoded bytes.
| |
| getString | back to summary |
|---|---|
| public String getString() Gets the UTF-8 value as a string. The returned string is always already interned.
| |
| getType | back to summary |
|---|---|
| public Type getType() Implements org. Doc from org. Gets the type associated with this instance.
| |
| getUtf16Size | back to summary |
|---|---|
| public int getUtf16Size() Gets the size of this instance as UTF-16 code points. That is,
get the number of 16-bit chars in the UTF-16 encoding of this
instance. This is the same as the
| |
| getUtf8Size | back to summary |
|---|---|
| public int getUtf8Size() Gets the size of this instance as UTF-8 code points. That is, get the number of bytes in the UTF-8 encoding of this instance.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isCategory2 | back to summary |
|---|---|
| public boolean isCategory2() Implements abstract org. Doc from org. Returns
| |
| stringToUtf8Bytes | back to summary |
|---|---|
| public static byte[] stringToUtf8Bytes(String string) Converts a string into its MUTF-8 form. MUTF-8 differs from normal UTF-8 in the handling of character '\0' and surrogate pairs.
| |
| throwBadUtf8 | back to summary |
|---|---|
| private static String throwBadUtf8(int value, int offset) Helper for
| |
| toHuman | back to summary |
|---|---|
| public String toHuman() Implements org. Doc from org. Return the "human" string form of this instance. This is
generally less "debuggy" than
| |
| toQuoted | back to summary |
|---|---|
| public String toQuoted() Gets the value as a human-oriented string, surrounded by double quotes.
| |
| toQuoted | back to summary |
|---|---|
| public String toQuoted(int maxLength) Gets the value as a human-oriented string, surrounded by double quotes, but ellipsizes the result if it is longer than the given maximum length
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| typeName | back to summary |
|---|---|
| public String typeName() Implements abstract org. Doc from org. Returns the human name for the particular type of constant this instance is. | |
| utf8BytesToString | back to summary |
|---|---|
| public static String utf8BytesToString(ByteArray bytes) Converts an array of UTF-8 bytes into a string. | |