Package com.ctc.wstx.util
Class TextBuilder
- java.lang.Object
-
- com.ctc.wstx.util.TextBuilder
-
public final class TextBuilder extends java.lang.Object
Class similar toStringBuilder
, except that it can be used to construct multiple Strings, that will share same underlying character buffer. This is generally useful for closely related value Strings, such as attribute values of a single XML start element.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
MAX_LEN
private char[]
mBuffer
private int
mBufferLen
private static int
MIN_LEN
private java.lang.String
mResultString
-
Constructor Summary
Constructors Constructor Description TextBuilder(int initialSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(char c)
void
append(char[] src, int start, int len)
char[]
bufferFull(int needSpaceFor)
java.lang.String
getAllValues()
char[]
getCharBuffer()
Method that gives access to underlying character bufferint
getCharSize()
boolean
isEmpty()
void
reset()
Method called before starting to (re)use the buffer, will discard any existing content, and start collecting new set of values.private void
resize(int needSpaceFor)
void
setBufferSize(int newSize)
java.lang.String
toString()
-
-
-
Field Detail
-
MIN_LEN
private static final int MIN_LEN
- See Also:
- Constant Field Values
-
MAX_LEN
private static final int MAX_LEN
- See Also:
- Constant Field Values
-
mBuffer
private char[] mBuffer
-
mBufferLen
private int mBufferLen
-
mResultString
private java.lang.String mResultString
-
-
Method Detail
-
reset
public void reset()
Method called before starting to (re)use the buffer, will discard any existing content, and start collecting new set of values.
-
isEmpty
public boolean isEmpty()
-
getAllValues
public java.lang.String getAllValues()
-
getCharBuffer
public char[] getCharBuffer()
Method that gives access to underlying character buffer
-
getCharSize
public int getCharSize()
-
append
public void append(char c)
-
append
public void append(char[] src, int start, int len)
-
setBufferSize
public void setBufferSize(int newSize)
-
bufferFull
public char[] bufferFull(int needSpaceFor)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
resize
private void resize(int needSpaceFor)
-
-