org.apache.xml.serialize
Class Printer
public
class
Printer
extends Object
The printer is responsible for sending text to the output stream
or writer. This class performs direct writing for efficiency.
IndentPrinter supports indentation and line wrapping by
extending this class.
Version: $Revision: 1.8 $ $Date: 2004/02/24 23:34:03 $
Author: Assaf Arkin
Field Summary |
protected Writer | _docWriter
Holds a reference to the document writer while we are
in DTD mode. |
protected StringWriter | _dtdWriter
The DTD writer. |
protected IOException | _exception
Holds the exception thrown by the serializer. |
protected OutputFormat | _format
The output format associated with this serializer. |
protected Writer | _writer
The writer to which the document is written. |
protected Writer _docWriter
Holds a reference to the document writer while we are
in DTD mode.
protected StringWriter _dtdWriter
The DTD writer. When we switch to DTD mode, all output is
accumulated in this DTD writer. When we switch out of it,
the output is obtained as a string. Must not be reset to
null until we're done with the document.
protected IOException _exception
Holds the exception thrown by the serializer. Exceptions do not cause
the serializer to quit, but are held and one is thrown at the end.
The output format associated with this serializer. This will never
be a null reference. If no format was passed to the constructor,
the default one for this document type will be used. The format
object is never changed by the serializer.
protected Writer _writer
The writer to which the document is written.
public void breakLine()
public void breakLine(boolean preserveSpace)
public void enterDTD()
Called by any of the DTD handlers to enter DTD mode.
Once entered, all output will be accumulated in a string
that can be printed as part of the document's DTD.
This method may be called any number of time but will only
have affect the first time it's called. To exist DTD state
and get the accumulated DTD, call
Printer.
public void flush()
Flush the output stream. Must be called when done printing
the document, otherwise some text might be buffered.
public void flushLine(boolean preserveSpace)
public IOException getException()
public int getNextIndent()
public void indent()
public String leaveDTD()
Called by the root element to leave DTD mode and if any
DTD parts were printer, will return a string with their
textual content.
public void printSpace()
public void printText(String text)
public void printText(StringBuffer text)
public void printText(char[] chars, int start, int length)
public void printText(char ch)
public void setNextIndent(int indent)
public void setThisIndent(int indent)
public void unindent()
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.