java.lang.ObjectTextBuffer
class TextBuffer
A non-public utility class similar to StringBuffer but optimized for XML parsing where the common case is that you get only one chunk of characters per text section. TextBuffer stores the first chunk of characters in a String, which can just be returned directly if no second chunk is received. Subsequent chunks are stored in a supplemental char array (like StringBuffer uses). In this case, the returned text will be the first String chunk, concatenated with the subsequent chunks stored in the char array. This provides optimal performance in the common case, while still providing very good performance in the uncommon case. Furthermore, avoiding StringBuffer means that no extra unused char array space will be kept around after parsing is through.
Field Summary | |
---|---|
private char[] | array The rest of the text value (the "suffix"). |
private int | arraySize The size of the rest of the text value. |
private static java.lang.String | CVS_ID |
private java.lang.String | prefixString The first part of the text value (the "prefix"). |
Constructor Summary | |
---|---|
TextBuffer() Constructor |
Method Summary | |
---|---|
(package private) void | append(char[] source, int start, int count) Append the specified text to the text value of this buffer. |
(package private) void | clear() Clears the text value and prepares the TextBuffer for reuse. |
private void | ensureCapacity(int csize) |
(package private) int | size() Returns the size of the text value. |
java.lang.String | toString() Returns the text value stored in the buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String CVS_ID
private java.lang.String prefixString
private char[] array
private int arraySize
Constructor Detail |
---|
TextBuffer()
Method Detail |
---|
void append(char[] source, int start, int count)
int size()
void clear()
public java.lang.String toString()
toString
in class java.lang.Object
private void ensureCapacity(int csize)