Class Printer
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.xml.serialize.Printer
-
- Direct Known Subclasses:
IndentPrinter
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.
-
-
Constructor Summary
Constructors Constructor Description Printer(Writer writer, OutputFormat format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
breakLine()
void
breakLine(boolean preserveSpace)
void
enterDTD()
Called by any of the DTD handlers to enter DTD mode.void
flush()
Flush the output stream.void
flushLine(boolean preserveSpace)
IOException
getException()
int
getNextIndent()
void
indent()
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.void
printSpace()
void
printText(char ch)
void
printText(char[] chars, int start, int length)
void
printText(String text)
void
printText(StringBuffer text)
void
setNextIndent(int indent)
void
setThisIndent(int indent)
void
unindent()
-
-
-
Constructor Detail
-
Printer
public Printer(Writer writer, OutputFormat format)
-
-
Method Detail
-
getException
public IOException getException()
-
enterDTD
public void enterDTD() throws IOException
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, callleaveDTD()
.- Throws:
IOException
-
leaveDTD
public String leaveDTD() throws IOException
Called by the root element to leave DTD mode and if any DTD parts were printer, will return a string with their textual content.- Throws:
IOException
-
printText
public void printText(String text) throws IOException
- Throws:
IOException
-
printText
public void printText(StringBuffer text) throws IOException
- Throws:
IOException
-
printText
public void printText(char[] chars, int start, int length) throws IOException
- Throws:
IOException
-
printText
public void printText(char ch) throws IOException
- Throws:
IOException
-
printSpace
public void printSpace() throws IOException
- Throws:
IOException
-
breakLine
public void breakLine() throws IOException
- Throws:
IOException
-
breakLine
public void breakLine(boolean preserveSpace) throws IOException
- Throws:
IOException
-
flushLine
public void flushLine(boolean preserveSpace) throws IOException
- Throws:
IOException
-
flush
public void flush() throws IOException
Flush the output stream. Must be called when done printing the document, otherwise some text might be buffered.- Throws:
IOException
-
indent
public void indent()
-
unindent
public void unindent()
-
getNextIndent
public int getNextIndent()
-
setNextIndent
public void setNextIndent(int indent)
-
setThisIndent
public void setThisIndent(int indent)
-
-