java.lang.StringBuilder , but
that allows for bit more efficient building, using segmented internal
buffers, and direct access to these buffers.
| Modifier and Type | Field and Description |
|---|---|
| private final ReaderConfig | |
| private char[] | |
| private int | _currentSize
Number of characters in currently active (last) segment |
| private char[] | |
| private int | |
| private int | |
| private boolean | _isIndentation
Marker to know if the contents currently stored were created using "indentation detection". |
| private char[] | |
| private int | _resultLen
Indicator for length of data with |
| private String | _resultString
String that will be constructed when the whole contents are needed; will be temporarily stored in case asked for again. |
| private ArrayList | _segments
List of segments prior to currently active segment. |
| private int | _segmentSize
Amount of characters in segments in |
| pack-priv static final int | DEF_INITIAL_BUFFER_SIZE
Size of the first text segment buffer to allocate. |
| pack-priv static final int | |
| public static final int | |
| public static final int | |
| pack-priv static final int | |
| private static final String | |
| private static final char[] | |
| private static final String[] | |
| private static final String | |
| private static final char[] | |
| private static final String[] | |
| pack-priv static final char[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private final char[] | |
| public void | |
| public void | |
| public void | |
| public void | |
| private char[] | |
| private int | |
| public char[] | |
| public String | |
| public int | |
| public static TextBuilder | |
| public int | decodeElements(TypedArrayDecoder tad, boolean reset)
Method called by the stream reader to decode space-separated tokens that are part of the current text event (contents of which are stored within this buffer), using given decoder. |
| public boolean | equalsString(String str)
Note it is assumed that this method is not used often enough to be a bottleneck, or for long segments. |
| private void | |
| public char[] | |
| public void | fireSaxCharacterEvents(ContentHandler h)
This is a specialized "accessor" method, which is basically to fire SAX characters() events in an optimal way, based on which internal buffers are being used |
| public void | |
| public void | |
| public char[] | |
| public int | |
| public char[] | |
| public boolean | |
| public int | |
| public void | recycle(boolean force)
Method called to indicate that the underlying buffers should now be recycled if they haven't yet been recycled. |
| public void | resetForBinaryDecode(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk)
Method called to initialize given base64 decoder with data contained in this text buffer (for the current event). |
| private final void | |
| public void | |
| public char[] | resetWithEmpty()
Method called to clear out any content text buffer may have, and initializes and returns the first segment to add characters to. |
| public void | |
| public void | |
| public void | |
| public int | |
| public String | toString()
Overrides java. Note calling this method may not be as efficient as calling
|
| _config | back to summary |
|---|---|
| private final ReaderConfig _config | |
| _currentSegment | back to summary |
|---|---|
| private char[] _currentSegment | |
| _currentSize | back to summary |
|---|---|
| private int _currentSize Number of characters in currently active (last) segment | |
| _decodeBuffer | back to summary |
|---|---|
| private char[] _decodeBuffer | |
| _decodeEnd | back to summary |
|---|---|
| private int _decodeEnd | |
| _decodePtr | back to summary |
|---|---|
| private int _decodePtr | |
| _isIndentation | back to summary |
|---|---|
| private boolean _isIndentation Marker to know if the contents currently stored were created using "indentation detection". If so, it's known to be all white space | |
| _resultArray | back to summary |
|---|---|
| private char[] _resultArray | |
| _resultLen | back to summary |
|---|---|
| private int _resultLen Indicator for length of data with | |
| _resultString | back to summary |
|---|---|
| private String _resultString String that will be constructed when the whole contents are needed; will be temporarily stored in case asked for again. | |
| _segments | back to summary |
|---|---|
| private ArrayList<char[]> _segments List of segments prior to currently active segment. | |
| _segmentSize | back to summary |
|---|---|
| private int _segmentSize Amount of characters in segments in | |
| DEF_INITIAL_BUFFER_SIZE | back to summary |
|---|---|
| pack-priv static final int DEF_INITIAL_BUFFER_SIZE Size of the first text segment buffer to allocate. Need not contain the biggest segment, since new ones will get allocated as needed. However, it's sensible to use something that often is big enough to contain typical segments. | |
| INT_SPACE | back to summary |
|---|---|
| pack-priv static final int INT_SPACE | |
| MAX_INDENT_SPACES | back to summary |
|---|---|
| public static final int MAX_INDENT_SPACES | |
| MAX_INDENT_TABS | back to summary |
|---|---|
| public static final int MAX_INDENT_TABS | |
| MAX_SEGMENT_LENGTH | back to summary |
|---|---|
| pack-priv static final int MAX_SEGMENT_LENGTH | |
| sIndSpaces | back to summary |
|---|---|
| private static final String sIndSpaces | |
| sIndSpacesArray | back to summary |
|---|---|
| private static final char[] sIndSpacesArray | |
| sIndSpacesStrings | back to summary |
|---|---|
| private static final String[] sIndSpacesStrings | |
| sIndTabs | back to summary |
|---|---|
| private static final String sIndTabs | |
| sIndTabsArray | back to summary |
|---|---|
| private static final char[] sIndTabsArray | |
| sIndTabsStrings | back to summary |
|---|---|
| private static final String[] sIndTabsStrings | |
| sNoChars | back to summary |
|---|---|
| pack-priv static final char[] sNoChars | |
| TextBuilder | back to summary |
|---|---|
| private TextBuilder(ReaderConfig cfg) | |
| allocBuffer | back to summary |
|---|---|
| private final char[] allocBuffer(int minNeeded) | |
| append | back to summary |
|---|---|
| public void append(char c) | |
| append | back to summary |
|---|---|
| public void append(char[] c, int start, int len) | |
| append | back to summary |
|---|---|
| public void append(String str) | |
| appendSurrogate | back to summary |
|---|---|
| public void appendSurrogate(int surr) | |
| buildResultArray | back to summary |
|---|---|
| private char[] buildResultArray() | |
| calcNewSize | back to summary |
|---|---|
| private int calcNewSize(int latestSize) | |
| contentsAsArray | back to summary |
|---|---|
| public char[] contentsAsArray() | |
| contentsAsString | back to summary |
|---|---|
| public String contentsAsString() | |
| contentsToArray | back to summary |
|---|---|
| public int contentsToArray(int srcStart, char[] dst, int dstStart, int len) | |
| createRecyclableBuffer | back to summary |
|---|---|
| public static TextBuilder createRecyclableBuffer(ReaderConfig cfg) | |
| decodeElements | back to summary |
|---|---|
| public int decodeElements(TypedArrayDecoder tad, boolean reset) throws TypedXMLStreamException Method called by the stream reader to decode space-separated tokens that are part of the current text event (contents of which are stored within this buffer), using given decoder. | |
| equalsString | back to summary |
|---|---|
| public boolean equalsString(String str) Note it is assumed that this method is not used often enough to be a bottleneck, or for long segments. Based on this, it is optimized for common simple cases where there is only one single character segment to use; fallback for other cases is to create such segment. | |
| expand | back to summary |
|---|---|
| private void expand(int roomNeeded) Method called when current segment is full, to allocate new segment. | |
| finishCurrentSegment | back to summary |
|---|---|
| public char[] finishCurrentSegment() | |
| fireSaxCharacterEvents | back to summary |
|---|---|
| public void fireSaxCharacterEvents(ContentHandler h) throws SAXException This is a specialized "accessor" method, which is basically to fire SAX characters() events in an optimal way, based on which internal buffers are being used | |
| fireSaxCommentEvent | back to summary |
|---|---|
| public void fireSaxCommentEvent(LexicalHandler h) throws SAXException | |
| fireSaxSpaceEvents | back to summary |
|---|---|
| public void fireSaxSpaceEvents(ContentHandler h) throws SAXException | |
| getBufferWithoutReset | back to summary |
|---|---|
| public char[] getBufferWithoutReset() | |
| getCurrentLength | back to summary |
|---|---|
| public int getCurrentLength() | |
| getTextBuffer | back to summary |
|---|---|
| public char[] getTextBuffer() | |
| isAllWhitespace | back to summary |
|---|---|
| public boolean isAllWhitespace() | |
| rawContentsTo | back to summary |
|---|---|
| public int rawContentsTo(Writer w) throws IOException Method that will stream contents of this buffer into specified Writer. | |
| recycle | back to summary |
|---|---|
| public void recycle(boolean force) Method called to indicate that the underlying buffers should now be recycled if they haven't yet been recycled. Although caller can still use this text buffer, it is not advisable to call this method if that is likely, since next time a buffer is needed, buffers need to reallocated. Note calling this method automatically also clears contents of the buffer. | |
| resetForBinaryDecode | back to summary |
|---|---|
| public void resetForBinaryDecode(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) Method called to initialize given base64 decoder with data contained in this text buffer (for the current event). | |
| resetForDecode | back to summary |
|---|---|
| private final void resetForDecode() | |
| resetWithChar | back to summary |
|---|---|
| public void resetWithChar(char c) Method called to initialize the buffer with just a single char | |
| resetWithEmpty | back to summary |
|---|---|
| public char[] resetWithEmpty() Method called to clear out any content text buffer may have, and initializes and returns the first segment to add characters to. | |
| resetWithIndentation | back to summary |
|---|---|
| public void resetWithIndentation(int indCharCount, char indChar) | |
| resetWithSurrogate | back to summary |
|---|---|
| public void resetWithSurrogate(int c) | |
| setCurrentLength | back to summary |
|---|---|
| public void setCurrentLength(int len) | |
| size | back to summary |
|---|---|
public int size()
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Note calling this method may not be as efficient as calling
| |