public final class TruffleStringBuilder extends Object
TruffleString
equivalent to StringBuilder
. This builder eagerly
fills up a byte array with all strings passed to its Append
-nodes. For lazy string
concatenation, use TruffleString.ConcatNode
instead.Modifier and Type | Class and Description |
---|---|
static class |
TruffleStringBuilder.AppendByteNode
Node to append a single byte to a string builder.
|
static class |
TruffleStringBuilder.AppendCharUTF16Node
Node to append a single char to a string builder.
|
static class |
TruffleStringBuilder.AppendCodePointNode
Node to append a codepoint to a string builder.
|
static class |
TruffleStringBuilder.AppendIntNumberNode
Node to append an integer to a string builder.
|
static class |
TruffleStringBuilder.AppendJavaStringUTF16Node
Node to append a substring of a given
String to a string builder. |
static class |
TruffleStringBuilder.AppendLongNumberNode
Node to append a
long value to a string builder. |
static class |
TruffleStringBuilder.AppendStringNode
Node to append a given
TruffleString to a string builder. |
static class |
TruffleStringBuilder.AppendSubstringByteIndexNode
Node to append a substring of a given
TruffleString to a string builder. |
static class |
TruffleStringBuilder.ToStringNode
Node to materialize a string builder as a
TruffleString . |
Modifier and Type | Method and Description |
---|---|
void |
appendByteUncached(byte value)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendByteNode . |
void |
appendCharUTF16Uncached(char value)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendCharUTF16Node . |
void |
appendCodePointUncached(int codepoint)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendCodePointNode . |
void |
appendCodePointUncached(int codepoint,
int repeat)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendCodePointNode . |
void |
appendCodePointUncached(int codepoint,
int repeat,
boolean allowUTF16Surrogates)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendCodePointNode . |
void |
appendIntNumberUncached(int value)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendIntNumberNode . |
void |
appendJavaStringUTF16Uncached(String a)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendJavaStringUTF16Node . |
void |
appendJavaStringUTF16Uncached(String a,
int fromCharIndex,
int charLength)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendJavaStringUTF16Node . |
void |
appendLongNumberUncached(long value)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendLongNumberNode . |
void |
appendStringUncached(TruffleString a)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendStringNode . |
void |
appendSubstringByteIndexUncached(TruffleString a,
int fromByteIndex,
int byteLength)
Shorthand for calling the uncached version of
TruffleStringBuilder.AppendSubstringByteIndexNode . |
int |
byteLength()
Returns this string builder's byte length.
|
static TruffleStringBuilder |
create(TruffleString.Encoding encoding)
Create a new string builder with the given encoding.
|
static TruffleStringBuilder |
create(TruffleString.Encoding encoding,
int initialCapacity)
Create a new string builder with the given encoding, and pre-allocate the given number of
bytes.
|
boolean |
isEmpty()
Returns true if the this string builder is empty.
|
String |
toString()
Convert the string builder's content to a java string.
|
TruffleString |
toStringUncached()
Shorthand for calling the uncached version of
TruffleStringBuilder.ToStringNode . |
public boolean isEmpty()
public int byteLength()
public static TruffleStringBuilder create(TruffleString.Encoding encoding)
public static TruffleStringBuilder create(TruffleString.Encoding encoding, int initialCapacity)
public void appendByteUncached(byte value)
TruffleStringBuilder.AppendByteNode
.public void appendCharUTF16Uncached(char value)
TruffleStringBuilder.AppendCharUTF16Node
.public void appendCodePointUncached(int codepoint)
TruffleStringBuilder.AppendCodePointNode
.public void appendCodePointUncached(int codepoint, int repeat)
TruffleStringBuilder.AppendCodePointNode
.public void appendCodePointUncached(int codepoint, int repeat, boolean allowUTF16Surrogates)
TruffleStringBuilder.AppendCodePointNode
.public void appendIntNumberUncached(int value)
TruffleStringBuilder.AppendIntNumberNode
.public void appendLongNumberUncached(long value)
TruffleStringBuilder.AppendLongNumberNode
.public void appendStringUncached(TruffleString a)
TruffleStringBuilder.AppendStringNode
.public void appendSubstringByteIndexUncached(TruffleString a, int fromByteIndex, int byteLength)
TruffleStringBuilder.AppendSubstringByteIndexNode
.public void appendJavaStringUTF16Uncached(String a)
TruffleStringBuilder.AppendJavaStringUTF16Node
.public void appendJavaStringUTF16Uncached(String a, int fromCharIndex, int charLength)
TruffleStringBuilder.AppendJavaStringUTF16Node
.public TruffleString toStringUncached()
TruffleStringBuilder.ToStringNode
.