org.opencyc.xml
Class XMLPrintWriter

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

public class XMLPrintWriter
extends XMLWriter

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

Author:
Stefano Bertolo

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
XMLPrintWriter(java.io.PrintStream printStream)
          Constructs an XMLPrintWriter object given a PrintStream.
 
Method Summary
 void close()
          Closes the PrintWriter in the field @see #writer.
 void flush()
          Flushes the PrintWriter in the field @see #writer.
 void indentPrint(java.lang.String string, int indent, boolean relative)
          Prints a string to the PrintWriter 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 PrintWriter stored in the field @see #writer.
 
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, toString, wait, wait, wait
 

Constructor Detail

XMLPrintWriter

public XMLPrintWriter(java.io.PrintStream printStream)
Constructs an XMLPrintWriter object given a PrintStream.
Parameters:
printStream - the PrintStream on which XML is output
Method Detail

indentPrint

public void indentPrint(java.lang.String string,
                        int indent,
                        boolean relative)
Prints a string to the PrintWriter 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 PrintWriter stored in the field @see #writer.
Overrides:
print in class XMLWriter
Parameters:
string - the string to be printed.

flush

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

close

public void close()
Closes the PrintWriter in the field @see #writer.
Overrides:
close in class XMLWriter