public final class LargeTextBuffer extends java.lang.ObjectThe segments (other than the last) have a fixed size of 65536 codepoints, which may use one byte per codepoint, two bytes per codepoint, or three bytes per codepoint, depending on the largest codepoint present in the segment.
This is more efficient than a buffer backed by a contiguous array of characters in cases where the size is likely to grow very large, and where substring operations are rare. As used within the TinyTree, extraction of the string value of a node requires character copying only in the case where the value crosses segment boundaries.
Constructors Constructor Description
LargeTextBuffer(int initialSize)Create an empty LargeTextBuffer
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
appendUnicodeString(UnicodeString chars)Append a string to the contents of the LargeTextBuffer
length()Get the number of characters in the LargeTextBuffer
setLength(int newLength)Set the length.
substring(int start, int end)Returns a new character sequence that is a subsequence of this sequence.
public void appendUnicodeString(UnicodeString chars)Append a string to the contents of the LargeTextBuffer
chars- the string to be added
public UnicodeString substring(int start, int end)Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index
end - 1. The length of the returned sequence is
end - start, so if
start == endthen an empty sequence is returned.
start- the start index, inclusive (codepoints, not bytes)
end- the end index, exclusive (codepoints, not bytes)
- the specified subsequence
endare negative, if
endis greater than
length(), or if
startis greater than
public void close()
public int length()Get the number of characters in the LargeTextBuffer
- the number of characters present
public void setLength(int newLength)Set the length. If this exceeds the current length, this method is a no-op. If this is less than the current length, characters beyond the specified point are deleted.
newLength- the new length