public abstract 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.
|
static TruffleStringBuilderUTF16 |
createUTF16()
Create a new UTF-16 string builder.
|
static TruffleStringBuilderUTF16 |
createUTF16(int initialCapacity)
Create a new UTF-16 string builder and pre-allocate the given number of chars.
|
static TruffleStringBuilderUTF32 |
createUTF32()
Create a new UTF-32 string builder.
|
static TruffleStringBuilderUTF32 |
createUTF32(int initialCapacity)
Create a new UTF-32 string builder and pre-allocate the given number of codepoints.
|
static TruffleStringBuilderUTF8 |
createUTF8()
Create a new UTF-8 string builder.
|
static TruffleStringBuilderUTF8 |
createUTF8(int initialCapacity)
Create a new UTF-8 string builder and pre-allocate the given number of bytes.
|
boolean |
isEmpty()
Returns true if 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 final boolean isEmpty()
public final int byteLength()
public static TruffleStringBuilder create(TruffleString.Encoding encoding)
If the encoding is known ahead of time, use TruffleStringBuilder.createUTF8()
, TruffleStringBuilder.createUTF16()
or
TruffleStringBuilder.createUTF32()
instead.
public static TruffleStringBuilder create(TruffleString.Encoding encoding, int initialCapacity)
If the encoding is known ahead of time, use TruffleStringBuilder.createUTF8(int)
,
TruffleStringBuilder.createUTF16(int)
or TruffleStringBuilder.createUTF32(int)
instead.
public static TruffleStringBuilderUTF8 createUTF8()
public static TruffleStringBuilderUTF8 createUTF8(int initialCapacity)
public static TruffleStringBuilderUTF16 createUTF16()
public static TruffleStringBuilderUTF16 createUTF16(int initialCapacity)
public static TruffleStringBuilderUTF32 createUTF32()
public static TruffleStringBuilderUTF32 createUTF32(int initialCapacity)
public final void appendByteUncached(byte value)
TruffleStringBuilder.AppendByteNode
.public final void appendCharUTF16Uncached(char value)
TruffleStringBuilder.AppendCharUTF16Node
.public final void appendCodePointUncached(int codepoint)
TruffleStringBuilder.AppendCodePointNode
.public final void appendCodePointUncached(int codepoint, int repeat)
TruffleStringBuilder.AppendCodePointNode
.public final void appendCodePointUncached(int codepoint, int repeat, boolean allowUTF16Surrogates)
TruffleStringBuilder.AppendCodePointNode
.public final void appendIntNumberUncached(int value)
TruffleStringBuilder.AppendIntNumberNode
.public final void appendLongNumberUncached(long value)
TruffleStringBuilder.AppendLongNumberNode
.public final void appendStringUncached(TruffleString a)
TruffleStringBuilder.AppendStringNode
.public final void appendSubstringByteIndexUncached(TruffleString a, int fromByteIndex, int byteLength)
TruffleStringBuilder.AppendSubstringByteIndexNode
.public final void appendJavaStringUTF16Uncached(String a)
TruffleStringBuilder.AppendJavaStringUTF16Node
.public final void appendJavaStringUTF16Uncached(String a, int fromCharIndex, int charLength)
TruffleStringBuilder.AppendJavaStringUTF16Node
.public final TruffleString toStringUncached()
TruffleStringBuilder.ToStringNode
.