com.ctc.wstx.util
Class TextBuilder

java.lang.Object
  extended by com.ctc.wstx.util.TextBuilder

public final class TextBuilder
extends java.lang.Object

Class similar to StringBuffer, 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 value Strings of a single XML start element.


Constructor Summary
TextBuilder(int initialSize)
           
 
Method Summary
 void append(char c)
           
 void append(char[] src, int start, int len)
           
 char[] bufferFull(int needSpaceFor)
           
 char[] getCharBuffer()
          Method that gives access to underlying character buffer
 int getCharSize()
           
 java.lang.String getEntry(int index)
           
 int getOffset(int index)
           
 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.
 void setBufferSize(int newSize)
           
 int size()
           
 void startNewEntry()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextBuilder

public TextBuilder(int initialSize)
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()

size

public int size()

getEntry

public java.lang.String getEntry(int index)

getOffset

public int getOffset(int index)

getCharBuffer

public char[] getCharBuffer()
Method that gives access to underlying character buffer


getCharSize

public int getCharSize()

startNewEntry

public void startNewEntry()

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 class java.lang.Object