Overview | Package | Class | Deprecated
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jibx.runtime.impl
Class StreamWriterBase

    java.lang.Object
      org.jibx.runtime.impl.XMLWriterNamespaceBase
          org.jibx.runtime.impl.XMLWriterBase
              org.jibx.runtime.impl.StreamWriterBase

All Implemented Interfaces:
  IXMLWriter

Direct Known Subclasses:
  ISO88591StreamWriter, UTF8StreamWriter

    public abstract class StreamWriterBase

extends XMLWriterBase

Base handler for marshalling text document to an output stream. This is designed for use with character encodings that use standard one-byte values for Unicode characters in the 0x20-0x7F range, which includes the most widely used encodings for XML documents. It needs to be subclassed with implementation methods specific to the encoding used.

Version:
  1.0
Author:
  Dennis M. Sosnoski

Constructor Summary
`StreamWriterBase(StreamWriterBase base, java.lang.String[] uris)` Copy constructor.
`StreamWriterBase(java.lang.String enc, java.lang.String[] uris)` Constructor.

Method Summary
`void` | `close()` Close document output.
`void` | `flush()` Flush document output.
`void` | `indent()` Request output indent.
`void` | `indent(int bias)` Request output indent.
`void` | `popExtensionNamespaces()` Remove extension namespace URIs.
`void` | `pushExtensionNamespaces(java.lang.String[] uris)` Append extension namespace URIs to those in mapping.
`void` | `reset()` Reset to initial state for reuse.
`void` | `setIndentSpaces(int count, java.lang.String newline, char indent)` Set nesting indentation.
`void` | `setOutput(java.io.OutputStream outs)` Set output stream.

Methods inherited from class org.jibx.runtime.impl.XMLWriterBase
`addAttribute, closeEmptyTag, closeStartTag, createChildWriter, endTag, startTagClosed, startTagNamespaces, startTagOpen, writeComment, writeDocType, writeEntityRef, writePI, writeXMLDecl`

Methods inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase
`getExtensionNamespaces, getNamespaceCount, getNamespacePrefix, getNamespaces, getNamespaceUri, getNestingDepth, getPrefixIndex, openNamespaces`

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

Methods inherited from interface org.jibx.runtime.IXMLWriter
`writeCData, writeTextContent`

Constructor Detail

### StreamWriterBase

    public StreamWriterBase(java.lang.String enc,
                            java.lang.String[] uris)

  Constructor.

  Parameters:
    `enc` - character encoding used for output to streams
    `uris` - ordered array of URIs for namespaces used in document (must be constant; the value in position 0 must always be the empty string "", and the value in position 1 must always be the XML namespace "http://www.w3.org/XML/1998/namespace")

### StreamWriterBase

    public StreamWriterBase(StreamWriterBase base,
                            java.lang.String[] uris)

  Copy constructor. This takes the stream and encoding information from a supplied instance, while setting a new array of namespace URIs. It's intended for use when invoking one binding from within another binding.

  Parameters:
    `base` - instance to be used as base for writer
    `uris` - ordered array of URIs for namespaces used in document (see `StreamWriterBase(String, String[])`)

Method Detail

### setOutput

    public void setOutput(java.io.OutputStream outs)

  Set output stream. If an output stream is currently open when this is called the existing stream is flushed and closed, with any errors ignored.

  Parameters:
    `outs` - stream for document data output

### setIndentSpaces

    public void setIndentSpaces(int count,
                                java.lang.String newline,
                                char indent)

  Set nesting indentation. This is advisory only, and implementations of this interface are free to ignore it. The intent is to indicate that the generated output should use indenting to illustrate element nesting.

  Parameters:
    `count` - number of character to indent per level, or disable indentation if negative (zero means new line only)
    `newline` - sequence of characters used for a line ending (`null` means use the single character '\n')
    `indent` - whitespace character used for indentation

### pushExtensionNamespaces

    public void pushExtensionNamespaces(java.lang.String[] uris)

  Append extension namespace URIs to those in mapping.

  Specified by:
    `pushExtensionNamespaces` in interface `IXMLWriter`
  Overrides:
    `pushExtensionNamespaces` in class `XMLWriterNamespaceBase`
  Parameters:
    `uris` - namespace URIs to extend those in mapping

### popExtensionNamespaces

    public void popExtensionNamespaces()

  Remove extension namespace URIs. This removes the last set of extension namespaces pushed using `pushExtensionNamespaces(java.lang.String[])`.

  Specified by:
    `popExtensionNamespaces` in interface `IXMLWriter`
  Overrides:
    `popExtensionNamespaces` in class `XMLWriterNamespaceBase`

### indent

    public void indent(int bias)
                throws java.io.IOException

  Request output indent. Output the line end sequence followed by the appropriate number of indent characters.

  Parameters:
    `bias` - indent depth difference (positive or negative) from current element nesting depth
  Throws:
    `java.io.IOException` - on error writing to document

### indent

    public void indent()
                throws java.io.IOException

  Request output indent. Output the line end sequence followed by the appropriate number of indent characters for the current nesting level.

  Throws:
    `java.io.IOException` - on error writing to document

### flush

    public void flush()
               throws java.io.IOException

  Flush document output. Forces out all output generated to this point.

  Specified by:
    `flush` in interface `IXMLWriter`
  Specified by:
    `flush` in class `XMLWriterBase`
  Throws:
    `java.io.IOException` - on error writing to document

### close

    public void close()
               throws java.io.IOException

  Close document output. Completes writing of document output, including closing the output medium.

  Specified by:
    `close` in interface `IXMLWriter`
  Specified by:
    `close` in class `XMLWriterBase`
  Throws:
    `java.io.IOException` - on error writing to document

### reset

    public void reset()

  Reset to initial state for reuse. This override of the base class method handles clearing the internal buffer when starting a new document.

  Specified by:
    `reset` in interface `IXMLWriter`
  Overrides:
    `reset` in class `XMLWriterBase`

Overview | Package | Class | Deprecated
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Project Web Site |