org.opencyc.xml
Class XMLStringWriter

java.lang.Object
  |
  +--org.opencyc.xml.XMLWriter
        |
        +--org.opencyc.xml.XMLStringWriter

public class XMLStringWriter
extends XMLWriter

Implements an XMLStringWriter with facilities for surrounding data elements with tags appropriately named and indented.

Author:
Stephen Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Constructor Summary
XMLStringWriter()
          Constructs an XMLStringWriter object.
 
Method Summary
 void close()
          Closes the StringWriter in the field @see #writer.
 void flush()
          Flushes the StringWriter in the field @see #writer.
 void indentPrint(java.lang.String string, int indent, boolean relative)
          Prints a string to the StringWriter stored in the field @see #writer indenting it by the number of spaces indicated by @see #indent either relative to the current indentation level (if @see #relative is true) or with respect to the beginning of the line (if @see #relative is false).
 void print(java.lang.String string)
          Prints a string to the StringWriter stored in the field @see #writer.
 java.lang.String toString()
          Return the buffer's current value as a string.
 
Methods inherited from class org.opencyc.xml.XMLWriter
getIndentLength, indentPrintln, indentPrintSafe, indentPrintSafeln, introduceXMLEntities, printSafe, printXMLAtomicTag, printXMLAtomicTag, printXMLAtomicTag, printXMLEndTag, printXMLEndTag, printXMLStartTag, printXMLStartTag, printXMLStartTag, printXMLStartTag, resetIndent, setIndent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLStringWriter

public XMLStringWriter()
Constructs an XMLStringWriter object.
Method Detail

indentPrint

public void indentPrint(java.lang.String string,
                        int indent,
                        boolean relative)
Prints a string to the StringWriter stored in the field @see #writer indenting it by the number of spaces indicated by @see #indent either relative to the current indentation level (if @see #relative is true) or with respect to the beginning of the line (if @see #relative is false).
Overrides:
indentPrint in class XMLWriter
Parameters:
string - the string to be printed.
indent - the number of spaces by which the string needs to be indented.
relative - id true the string is further indented with respect to the current indentation level, if false is indented with respect to the beginning of the line.

print

public void print(java.lang.String string)
Prints a string to the StringWriter stored in the field @see #writer.
Overrides:
print in class XMLWriter
Parameters:
string - the string to be printed.

flush

public void flush()
Flushes the StringWriter in the field @see #writer.
Overrides:
flush in class XMLWriter

close

public void close()
           throws java.io.IOException
Closes the StringWriter in the field @see #writer.
Overrides:
close in class XMLWriter

toString

public java.lang.String toString()
Return the buffer's current value as a string.
Overrides:
toString in class java.lang.Object