Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## BEA WebLogic Server 9.0 API Reference

## weblogic.apache.xml.serialize
Class Printer

    java.lang.Object
      weblogic.apache.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.

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.

Constructor Summary
`Printer(Writer writer, OutputFormat format)`

Method Summary
`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()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _docWriter

    protected Writer _docWriter

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

### _dtdWriter

    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.

### _exception

    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.

### _format

    protected final OutputFormat _format

  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.

### _writer

    protected Writer _writer

  The writer to which the document is written.

Constructor Detail

### Printer

    public Printer(Writer writer,
                   OutputFormat format)

Method Detail

### breakLine

    public void breakLine()
                   throws IOException

  Throws:
    `IOException`

### breakLine

    public void breakLine(boolean preserveSpace)
                   throws IOException

  Throws:
    `IOException`

### 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, call `leaveDTD()`.

  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`

### flushLine

    public void flushLine(boolean preserveSpace)
                   throws IOException

  Throws:
    `IOException`

### getException

    public IOException getException()

### getNextIndent

    public int getNextIndent()

### indent

    public void indent()

### 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`

### printSpace

    public void printSpace()
                    throws IOException

  Throws:
    `IOException`

### printText

    public void printText(char ch)
                   throws IOException

  Throws:
    `IOException`

### printText

    public void printText(char[] chars,
                          int start,
                          int length)
                   throws IOException

  Throws:
    `IOException`

### printText

    public void printText(String text)
                   throws IOException

  Throws:
    `IOException`

### printText

    public void printText(StringBuffer text)
                   throws IOException

  Throws:
    `IOException`

### setNextIndent

    public void setNextIndent(int indent)

### setThisIndent

    public void setThisIndent(int indent)

### unindent

    public void unindent()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs90 Copyright 2005 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD