APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.serialize

public Class Printer

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.xml.internal.serialize.IndentPrinter
Annotations
@Deprecated
Imports
java.io.Writer, .StringWriter, .IOException

Deprecated

As of JDK 9, Xerces 2.9.0, Xerces DOM L3 Serializer implementation is replaced by that of Xalan. Main class com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl is replaced by com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl.

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.
Author
Assaf Arkin

Field Summary

Modifier and TypeField and Description
private final char[]
_buffer

Output buffer.

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 final OutputFormat
_format

References Deprecated OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.
The output format associated with this serializer.
private int
_pos

Position within the output buffer.

protected Writer
_writer

The writer to which the document is written.

private static final int
BufferSize

The size of the output buffer.

Constructor Summary

AccessConstructor and Description
public
Printer(Writer writer, OutputFormat format)
References Deprecated OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
public void
public void
breakLine(boolean preserveSpace)

public void
enterDTD()

Called by any of the DTD handlers to enter DTD mode.

public void
flush()

Flush the output stream.

public void
flushLine(boolean preserveSpace)

public IOException
public int
public void
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
public void
public void
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
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bufferback to summary
private final char[] _buffer

Output buffer.

_docWriterback to summary
protected Writer _docWriter

Holds a reference to the document writer while we are in DTD mode.

_dtdWriterback to summary
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.

_exceptionback to summary
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.

_formatback to summary
protected final OutputFormat _format

References Deprecated

OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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.

_posback to summary
private int _pos

Position within the output buffer.

_writerback to summary
protected Writer _writer

The writer to which the document is written.

BufferSizeback to summary
private static final int BufferSize

The size of the output buffer.

Constructor Detail

Printerback to summary
public Printer(Writer writer, OutputFormat format)

References Deprecated

OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

breakLineback to summary
public void breakLine() throws IOException
breakLineback to summary
public void breakLine(boolean preserveSpace) throws IOException
enterDTDback to summary
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, call leaveDTD.

flushback to summary
public void flush() throws IOException

Flush the output stream. Must be called when done printing the document, otherwise some text might be buffered.

flushLineback to summary
public void flushLine(boolean preserveSpace) throws IOException
getExceptionback to summary
public IOException getException()
getNextIndentback to summary
public int getNextIndent()
indentback to summary
public void indent()
leaveDTDback to summary
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.

printSpaceback to summary
public void printSpace() throws IOException
printTextback to summary
public void printText(String text) throws IOException
printTextback to summary
public void printText(StringBuffer text) throws IOException
printTextback to summary
public void printText(char[] chars, int start, int length) throws IOException
printTextback to summary
public void printText(char ch) throws IOException
setNextIndentback to summary
public void setNextIndent(int indent)
setThisIndentback to summary
public void setThisIndent(int indent)
unindentback to summary
public void unindent()