Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

## oracle.xml.parser.v2
Class XMLOutputStream

`java.lang.Object
oracle.xml.parser.v2.XMLOutputStream`

      public class XMLOutputStream

extends java.lang.Object

XMLOutputSteam -- writes output stream, can handle XML encoding

Field Summary
`static int` `COMPACT`
`static int` `DEFAULT`
`static int` `NO_REUSE`
`static int` `PRETTY`
`static int` `REUSE`

Constructor Summary
`XMLOutputStream(java.io.OutputStream outs)` Builds the ASCII output stream (as a byte stream)
`XMLOutputStream(java.io.Writer outw)` Builds the output stream from a Writer (also PrintWriter) (as a character stream)

Method Summary
`void` `addIndent(int offset)` Set indenting level for output
`void` `close()` Closes the output stream.
`void` `close(int option)` Closes the output stream based on the option.
`void` `flush()` Flushes the output stream
`int` `getOutputStyle()` Gets the Current output style
`void` `setEncoding(java.lang.String encoding, boolean lendian, boolean byteOrderMark)` Sets the output character encoding for a byte stream.
`void` `setEOLChars(java.lang.String nl)` Set newline characters
`void` `setOutputStyle(int style)` Sets the Output the style
`void` `write(int c)` Outputs character according to type of the output stream
`void` `writeChars(java.lang.String str)` Write string to the output
`void` `writeIndent()` Output the indentation
`void` `writeNewLine()` Newline writer
`void` `writeQuotedString(java.lang.String str)` Write string with surrounding quotes

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

Field Detail

### DEFAULT

    public static final int DEFAULT

  See Also:
    Constant Field Values

### PRETTY

    public static final int PRETTY

  See Also:
    Constant Field Values

### COMPACT

    public static final int COMPACT

  See Also:
    Constant Field Values

### REUSE

    public static final int REUSE

  See Also:
    Constant Field Values

### NO_REUSE

    public static final int NO_REUSE

  See Also:
    Constant Field Values

Constructor Detail

### XMLOutputStream

    public XMLOutputStream(java.io.OutputStream outs)

  Builds the ASCII output stream (as a byte stream)
  Parameters:
    `out` - the output stream

### XMLOutputStream

    public XMLOutputStream(java.io.Writer outw)

  Builds the output stream from a Writer (also PrintWriter) (as a character stream)
  Parameters:
    `out` - the Writer stream

Method Detail

### setEOLChars

    public void setEOLChars(java.lang.String nl)

  Set newline characters

### setEncoding

    public void setEncoding(java.lang.String encoding,
                            boolean lendian,
                            boolean byteOrderMark)
                     throws java.io.IOException

  Sets the output character encoding for a byte stream. This only applies to a byte stream, not to a character stream.
  Parameters:
    `encoding` - the encoding of the (byte) stream
    `lendian` - flag to indicate if the encoding is of type little endian
    `byteOrderMark` - flag to indicate if byte order mark is set
  Throws:
    `java.io.IOException` - if error is thrown in setting the encoding type

### flush

    public void flush()
               throws java.io.IOException

  Flushes the output stream
  Throws:
    `java.io.IOException` - if there is any error in flushing the output stream

### close

    public void close()
               throws java.io.IOException

  Closes the output stream. Migrate to close(int option).
  Throws:
    `java.io.IOException` - if there is any error in closing the output stream

### close

    public void close(int option)
               throws java.io.IOException

  Closes the output stream based on the option. Legal values are: REUSE and NO_REUSE.
  Parameters:
    `option` - determines whether output stream has to be closed.
  Throws:
    `java.io.IOException` - if there is any error in closing the output stream.

### write

    public void write(int c)
               throws java.io.IOException

  Outputs character according to type of the output stream
  Parameters:
    `c` - the character that needs to be written. Note that c can be either a standard Unicode code point (i.e., using UTF-32 encoding); or it may be just one member of a surrogate pair, either a high surrogate or a low surrogate. I.e., for supplementary characters, which use surrogate pairs in UTF-16, we may have to call write() twice in order to write one logical character.
  Throws:
    `java.io.IOException` - if there is any error in writing the character

### writeChars

    public void writeChars(java.lang.String str)
                    throws java.io.IOException

  Write string to the output
  Parameters:
    `str` - the string that is written to the output stream
  Throws:
    `java.io.IOException` - error thrown if there is any error in writing the string

### writeQuotedString

    public void writeQuotedString(java.lang.String str)
                           throws java.io.IOException

  Write string with surrounding quotes
  Parameters:
    `str` - the string that is written to the output stream
  Throws:
    `java.io.IOException` - error thrown if there is any error in writing the string

### writeNewLine

    public void writeNewLine()
                      throws java.io.IOException

  Newline writer
  Throws:
    `java.io.IOException` - error thrown if there is any error in writing the string

### addIndent

    public void addIndent(int offset)

  Set indenting level for output
  Parameters:
    `offset` - the indenting level

### writeIndent

    public void writeIndent()
                     throws java.io.IOException

  Output the indentation
  Throws:
    `java.io.IOException` - error thrown if there is any error in writing the string

### setOutputStyle

    public void setOutputStyle(int style)

  Sets the Output the style
  Parameters:
    `style` - the output style

### getOutputStyle

    public int getOutputStyle()

  Gets the Current output style
  Returns:
    the output style

Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.