uxparser
Class XText

java.lang.Object
  extended by uxparser.XContent
      extended by uxparser.XText

public final class XText
extends XContent

XText is the XContent element child used to store character data. XText is used to model both CDATA sections and normal character data.


Constructor Summary
XText()
          Create empty text.
XText(char[] data)
          Create text with specified char buffer using length of data.length.
XText(char[] data, int length)
          Create text with specified char buffer and length.
XText(java.lang.String string)
          Create text with specified String.
 
Method Summary
 void append(char[] buf, int off, int len)
          Append the specified string to the end of the character data.
 void append(int c)
          Append the specified character to the end of the character data.
 void append(java.lang.String s)
          Append the specified string to the end of the character data.
 XText copy()
          Make a new cloned copy of this XText instance.
 char[] data()
          Get a direct reference to the character data buffer.
 boolean isCDATA()
          Return true if this XText models a CDATA section of data.
 int length()
          Get the length of the character data.
 void set(int index, int c)
          Set the character at the specified index.
 void setCDATA(boolean cdata)
          Set the CDATA flag.
 void setLength(int length)
          Set the length of valid characters in the buffer.
 java.lang.String string()
          Get the character data as a string.
 java.lang.String toString()
          Return string().
 void write(XWriter out)
          Write to the specified XWriter stream.
 
Methods inherited from class uxparser.XContent
equals, parent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XText

public XText(char[] data,
             int length)
Create text with specified char buffer and length.


XText

public XText(char[] data)
Create text with specified char buffer using length of data.length.


XText

public XText(java.lang.String string)
Create text with specified String.


XText

public XText()
Create empty text.

Method Detail

isCDATA

public final boolean isCDATA()
Return true if this XText models a CDATA section of data.


setCDATA

public final void setCDATA(boolean cdata)
Set the CDATA flag.


string

public final java.lang.String string()
Get the character data as a string.


length

public final int length()
Get the length of the character data.


data

public final char[] data()
Get a direct reference to the character data buffer. Only the range of characters from 0 to length()-1 are valid. Do not modify the buffer directly, rather use the dedicated modification method.


append

public final void append(int c)
Append the specified character to the end of the character data.


append

public final void append(java.lang.String s)
Append the specified string to the end of the character data.


append

public final void append(char[] buf,
                         int off,
                         int len)
Append the specified string to the end of the character data.


set

public final void set(int index,
                      int c)
Set the character at the specified index.

Throws:
java.lang.ArrayIndexOutOfBoundsException - if index >= length().

setLength

public final void setLength(int length)
Set the length of valid characters in the buffer.


copy

public final XText copy()
Make a new cloned copy of this XText instance.


write

public void write(XWriter out)
Write to the specified XWriter stream.

Specified by:
write in class XContent

toString

public java.lang.String toString()
Return string().

Overrides:
toString in class java.lang.Object