Interface Utf8Entry
- All Superinterfaces:
AnnotationConstantValueEntry, CharSequence, PoolEntry
CONSTANT_UTF8_info constant, representing strings, in the
constant pool of a class file. This describes strings in the
Modified UTF-8 format.
The use of a Utf8Entry is represented by a String.
Conversions are through ConstantPoolBuilder.utf8Entry(String) and
stringValue().
Some uses of Utf8Entry represent field or method descriptor strings, symbolically
represented as ClassDesc or MethodTypeDesc, depending on
where a Utf8Entry appear. Entries representing such uses are created
with ConstantPoolBuilder.utf8Entry(ClassDesc) and ConstantPoolBuilder.utf8Entry(MethodTypeDesc), and they can be converted to
symbolic descriptors on a per-use-site basis, such as in AnnotationValue.OfClass.classSymbol() and MethodModel.methodTypeSymbol().
Unlike most constant pool entries, a UTF-8 entry is of flexible length: it is
represented as an array structure, with an u2 for the data length in
bytes, followed by that number of bytes of Modified UTF-8 data. It can
represent at most 65535 bytes of data due to the physical restrictions of
u2.
- See Java Virtual Machine Specification:
-
4.4.7 The
CONSTANT_Utf8_infoStructure - Since:
- 24
- See Also:
-
Field Summary
Fields declared in interface PoolEntry
TAG_CLASS, TAG_DOUBLE, TAG_DYNAMIC, TAG_FIELDREF, TAG_FLOAT, TAG_INTEGER, TAG_INTERFACE_METHODREF, TAG_INVOKE_DYNAMIC, TAG_LONG, TAG_METHOD_HANDLE, TAG_METHOD_TYPE, TAG_METHODREF, TAG_MODULE, TAG_NAME_AND_TYPE, TAG_PACKAGE, TAG_STRING, TAG_UTF8Modifier and TypeFieldDescriptionstatic final intThe tag forCONSTANT_Classconstant kind.static final intThe tag forCONSTANT_Doubleconstant kind.static final intThe tag forCONSTANT_Dynamicconstant kind.static final intThe tag forCONSTANT_Fieldrefconstant kind.static final intThe tag forCONSTANT_Floatconstant kind.static final intThe tag forCONSTANT_Integerconstant kind.static final intThe tag forCONSTANT_InterfaceMethodrefconstant kind.static final intThe tag forCONSTANT_InvokeDynamicconstant kind.static final intThe tag forCONSTANT_Longconstant kind.static final intThe tag forCONSTANT_MethodHandleconstant kind.static final intThe tag forCONSTANT_MethodTypeconstant kind.static final intThe tag forCONSTANT_Methodrefconstant kind.static final intThe tag forCONSTANT_Moduleconstant kind.static final intThe tag forCONSTANT_NameAndTypeconstant kind.static final intThe tag forCONSTANT_Packageconstant kind.static final intThe tag forCONSTANT_Stringconstant kind.static final intThe tag forCONSTANT_Utf8constant kind. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this entry describes the same string as the provided string.booleanisFieldType(ClassDesc desc) Returns whether this entry describes the descriptor string of this field type.booleanisMethodType(MethodTypeDesc desc) Returns whether this entry describes the descriptor string of this method type.Returns the string value for this entry.Methods declared in interface AnnotationConstantValueEntry
constantValueMethods declared in interface CharSequence
charAt, chars, codePoints, getChars, isEmpty, length, subSequence, toStringModifier and TypeMethodDescriptioncharcharAt(int index) Returns thecharvalue at the specified index.default IntStreamchars()Returns a stream ofintzero-extending thecharvalues from this sequence.default IntStreamReturns a stream of code point values from this sequence.default voidgetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) Copies characters from this sequence into the given destination array.default booleanisEmpty()Returnstrueif this character sequence is empty.intlength()Returns the length of this character sequence.subSequence(int start, int end) Returns aCharSequencethat is a subsequence of this sequence.toString()Returns a string containing the characters in this sequence in the same order as this sequence.Methods declared in interface PoolEntry
constantPool, index, tag, widthModifier and TypeMethodDescriptionReturns the constant pool this entry is from.intindex()Returns the index within the constant pool corresponding to this entry.inttag()Returns the constant pool tag that describes the type of this entry.intwidth()Returns the number of constant pool slots this entry consumes.
-
Method Details
-
stringValue
String stringValue()Returns the string value for this entry.- API Note:
- A
Utf8Entrycan be used directly as aCharSequenceifStringfunctionalities are not strictly desired. If only string equivalence is desired,equalsStringshould be used. Reduction of string processing can significantly improveclassfile reading performance. - Returns:
- the string value for this entry
- See Also:
-
equalsString
Returns whether this entry describes the same string as the provided string.- Parameters:
s- the string to compare to- Returns:
- whether this entry describes the same string as the provided string
-
isFieldType
Returns whether this entry describes the descriptor string of this field type.- Parameters:
desc- the field type- Returns:
- whether this entry describes the descriptor string of this field type
- Since:
- 25
-
isMethodType
Returns whether this entry describes the descriptor string of this method type.- Parameters:
desc- the method type- Returns:
- whether this entry describes the descriptor string of this method type
- Since:
- 25
-