|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ctc.wstx.util.TextBuffer
public final class TextBuffer
TextBuffer is a class similar to StringBuffer
, with
following differences:
Notes about usage: for debugging purposes, it's suggested to use
toString()
method, as opposed to
contentsAsArray()
or contentsAsString()
. Internally
resulting code paths may or may not be different, WRT caching.
Field Summary | |
---|---|
static int |
MAX_INDENT_SPACES
|
static int |
MAX_INDENT_TABS
|
Method Summary | |
---|---|
void |
append(char c)
|
void |
append(char[] c,
int start,
int len)
|
void |
append(java.lang.String str)
|
char[] |
contentsAsArray()
|
java.lang.String |
contentsAsString()
|
int |
contentsToArray(int srcStart,
char[] dst,
int dstStart,
int len)
|
static TextBuffer |
createRecyclableBuffer(ReaderConfig cfg)
|
static TextBuffer |
createTemporaryBuffer(int initialSize)
|
boolean |
endsWith(java.lang.String str)
Method that can be used to check if the contents of the buffer end in specified String. |
void |
ensureNotShared()
Method called to make sure that buffer is not using shared input buffer; if it is, it will copy such contents to private buffer. |
boolean |
equalsString(java.lang.String str)
Note: it is assumed that this method is not used often enough to be a bottleneck, or for long segments. |
char[] |
finishCurrentSegment()
|
void |
fireDtdCommentEvent(DTDEventListener l)
|
void |
fireSaxCharacterEvents(org.xml.sax.ContentHandler h)
|
void |
fireSaxCommentEvent(org.xml.sax.ext.LexicalHandler h)
|
void |
fireSaxSpaceEvents(org.xml.sax.ContentHandler h)
|
char[] |
getCurrentSegment()
|
int |
getCurrentSegmentSize()
|
char[] |
getTextBuffer()
|
int |
getTextStart()
|
boolean |
isAllWhitespace()
|
int |
rawContentsTo(java.io.Writer w)
Method that will stream contents of this buffer into specified Writer. |
java.io.Reader |
rawContentsViaReader()
|
void |
recycle(boolean force)
Method called to indicate that the underlying buffers should now be recycled if they haven't yet been recycled. |
void |
resetInitialized()
Method called to make sure there is a non-shared segment to use, without appending any content yet. |
void |
resetWithCopy(char[] buf,
int start,
int len)
|
void |
resetWithEmpty()
Method called to clear out any content text buffer may have, and initializes buffer to use non-shared data. |
void |
resetWithIndentation(int indCharCount,
char indChar)
|
void |
resetWithShared(char[] buf,
int start,
int len)
Method called to initialize the buffer with a shared copy of data; this means that buffer will just have pointers to actual data. |
void |
setCurrentLength(int len)
|
int |
size()
|
java.lang.String |
toString()
Note: calling this method may not be as efficient as calling contentsAsString() , since it's not guaranteed that resulting
String is cached. |
void |
unshare(int needExtra)
Method called if/when we need to append content when we have been initialized to use shared buffer. |
void |
validateText(XMLValidator vld,
boolean lastSegment)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_INDENT_SPACES
public static final int MAX_INDENT_TABS
Method Detail |
---|
public static TextBuffer createRecyclableBuffer(ReaderConfig cfg)
public static TextBuffer createTemporaryBuffer(int initialSize)
public void recycle(boolean force)
public void resetWithEmpty()
public void resetWithShared(char[] buf, int start, int len)
public void resetWithCopy(char[] buf, int start, int len)
public void resetInitialized()
public void resetWithIndentation(int indCharCount, char indChar)
public int size()
public int getTextStart()
public char[] getTextBuffer()
public java.lang.String contentsAsString()
public char[] contentsAsArray()
public int contentsToArray(int srcStart, char[] dst, int dstStart, int len)
public int rawContentsTo(java.io.Writer w) throws java.io.IOException
java.io.IOException
public java.io.Reader rawContentsViaReader() throws java.io.IOException
java.io.IOException
public boolean isAllWhitespace()
public boolean endsWith(java.lang.String str)
public boolean equalsString(java.lang.String str)
public void fireSaxCharacterEvents(org.xml.sax.ContentHandler h) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void fireSaxSpaceEvents(org.xml.sax.ContentHandler h) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void fireSaxCommentEvent(org.xml.sax.ext.LexicalHandler h) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void fireDtdCommentEvent(DTDEventListener l)
public void validateText(XMLValidator vld, boolean lastSegment) throws XMLValidationException
XMLValidationException
public void ensureNotShared()
public void append(char c)
public void append(char[] c, int start, int len)
public void append(java.lang.String str)
public char[] getCurrentSegment()
public int getCurrentSegmentSize()
public void setCurrentLength(int len)
public char[] finishCurrentSegment()
public java.lang.String toString()
contentsAsString()
, since it's not guaranteed that resulting
String is cached.
toString
in class java.lang.Object
public void unshare(int needExtra)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |