public final class MutableTruffleString extends AbstractTruffleString
TruffleString
. This class also accepts all operations
of TruffleString. This class is not thread-safe and allows overwriting bytes in its internal byte
array or native pointer via MutableTruffleString.WriteByteNode
. The internal array or native pointer may also
be modified externally, but the corresponding MutableTruffleString must be notified of this via
MutableTruffleString.notifyExternalMutation()
. MutableTruffleString is not a Truffle interop type, and must
be converted to an immutable TruffleString
via TruffleString.AsTruffleStringNode
before passing
a language boundary.TruffleString
Modifier and Type | Class and Description |
---|---|
static class |
MutableTruffleString.AsManagedNode
Node to get the given
AbstractTruffleString as a managed
MutableTruffleString , meaning that the resulting string's backing memory is not a
native pointer. |
static class |
MutableTruffleString.AsMutableTruffleStringNode
Node to get a
AbstractTruffleString as a MutableTruffleString . |
static class |
MutableTruffleString.ConcatNode
Node to create a new
MutableTruffleString by concatenating two strings. |
static class |
MutableTruffleString.ForceEncodingNode
Node to forcibly assign any encoding to a string.
|
static class |
MutableTruffleString.FromByteArrayNode
Node to create a new
MutableTruffleString from a byte array. |
static class |
MutableTruffleString.FromNativePointerNode
Node to create a new
MutableTruffleString from an interop object representing a
native pointer. |
static class |
MutableTruffleString.SubstringByteIndexNode
MutableTruffleString.SubstringNode , but with byte indices. |
static class |
MutableTruffleString.SubstringNode
Node to create a new mutable substring of a string.
|
static class |
MutableTruffleString.SwitchEncodingNode
Node to get a given string in a specific encoding.
|
static class |
MutableTruffleString.WriteByteNode
Node to write a byte into a mutable string.
|
Modifier and Type | Method and Description |
---|---|
MutableTruffleString |
concatUncached(AbstractTruffleString b,
TruffleString.Encoding expectedEncoding)
Shorthand for calling the uncached version of
MutableTruffleString.ConcatNode . |
static MutableTruffleString |
fromByteArrayUncached(byte[] value,
int byteOffset,
int byteLength,
TruffleString.Encoding encoding,
boolean copy)
Shorthand for calling the uncached version of
MutableTruffleString.FromByteArrayNode . |
static MutableTruffleString |
fromNativePointerUncached(Object pointerObject,
int byteOffset,
int byteLength,
TruffleString.Encoding encoding,
boolean copy)
Shorthand for calling the uncached version of
MutableTruffleString.FromNativePointerNode . |
void |
notifyExternalMutation()
Notify this mutable string of an external modification of its internal content.
|
MutableTruffleString |
substringByteIndexUncached(int byteOffset,
int byteLength,
TruffleString.Encoding expectedEncoding)
Shorthand for calling the uncached version of
MutableTruffleString.SubstringByteIndexNode . |
MutableTruffleString |
substringUncached(int byteOffset,
int byteLength,
TruffleString.Encoding expectedEncoding)
Shorthand for calling the uncached version of
MutableTruffleString.SubstringNode . |
void |
writeByteUncached(int byteIndex,
byte value,
TruffleString.Encoding expectedEncoding)
Shorthand for calling the uncached version of
MutableTruffleString.WriteByteNode . |
asManagedMutableTruffleStringUncached, asManagedTruffleStringUncached, asManagedTruffleStringUncached, asMutableTruffleStringUncached, asTruffleStringUncached, byteIndexOfAnyByteUncached, byteIndexOfCodePointUncached, byteIndexOfStringUncached, byteIndexOfStringUncached, byteIndexToCodePointIndexUncached, byteLength, byteLengthOfCodePointUncached, byteLengthOfCodePointUncached, charIndexOfAnyCharUTF16Uncached, codePointAtByteIndexUncached, codePointAtByteIndexUncached, codePointAtIndexUncached, codePointAtIndexUncached, codePointIndexToByteIndexUncached, codePointLengthUncached, codeRangeEqualsUncached, compareBytesUncached, compareCharsUTF16Uncached, compareIntsUTF32Uncached, concatUncached, copyToByteArrayUncached, copyToByteArrayUncached, copyToNativeMemoryUncached, createBackwardCodePointIteratorUncached, createCodePointIteratorUncached, equals, equalsUncached, forceEncodingUncached, getByteCodeRangeUncached, getCodeRangeImpreciseUncached, getCodeRangeUncached, getInternalByteArrayUncached, getInternalNativePointerUncached, getStringCompactionLevelUncached, hashCode, hashCodeUncached, indexOfCodePointUncached, indexOfStringUncached, intIndexOfAnyIntUTF32Uncached, isCompatibleToUncached, isEmpty, isImmutable, isManaged, isMutable, isNative, isValidUncached, lastByteIndexOfCodePointUncached, lastByteIndexOfStringUncached, lastByteIndexOfStringUncached, lastIndexOfCodePointUncached, lastIndexOfStringUncached, materializeUncached, parseDoubleUncached, parseIntUncached, parseIntUncached, parseLongUncached, parseLongUncached, readByteUncached, readCharUTF16Uncached, regionEqualByteIndexUncached, regionEqualByteIndexUncached, regionEqualsUncached, repeatUncached, substringByteIndexUncached, substringUncached, switchEncodingUncached, switchEncodingUncached, toJavaStringUncached, toString, toStringDebug
public void notifyExternalMutation()
MutableTruffleString.WriteByteNode
) to the byte array or
native pointer the string is using as internal storage. Exemplary usage scenario: Suppose a
MutableTruffleString
was created by wrapping a native pointer via
MutableTruffleString.FromNativePointerNode
. If the native pointer is passed to a native function that may
modify the pointer's contents, this method must be called afterwards, to ensure consistency.public static MutableTruffleString fromByteArrayUncached(byte[] value, int byteOffset, int byteLength, TruffleString.Encoding encoding, boolean copy)
MutableTruffleString.FromByteArrayNode
.public static MutableTruffleString fromNativePointerUncached(Object pointerObject, int byteOffset, int byteLength, TruffleString.Encoding encoding, boolean copy)
MutableTruffleString.FromNativePointerNode
.public void writeByteUncached(int byteIndex, byte value, TruffleString.Encoding expectedEncoding)
MutableTruffleString.WriteByteNode
.public MutableTruffleString concatUncached(AbstractTruffleString b, TruffleString.Encoding expectedEncoding)
MutableTruffleString.ConcatNode
.public MutableTruffleString substringUncached(int byteOffset, int byteLength, TruffleString.Encoding expectedEncoding)
MutableTruffleString.SubstringNode
.public MutableTruffleString substringByteIndexUncached(int byteOffset, int byteLength, TruffleString.Encoding expectedEncoding)
MutableTruffleString.SubstringByteIndexNode
.