## javanet.staxutils.io
Class StreamEventWriter

    java.lang.Object
      javanet.staxutils.BaseXMLEventWriter
          javanet.staxutils.io.StreamEventWriter

All Implemented Interfaces:
  XMLEventConsumer, XMLEventWriter

    public class StreamEventWriter

extends BaseXMLEventWriter

`XMLEventWriter` that writes events to a character stream using `XMLEvent.writeAsEncodedUnicode(Writer)`.

Version:
  $Revision: 1.4 $
Author:
  Christian Niles

Field Summary

Fields inherited from class javanet.staxutils.BaseXMLEventWriter
`attrBuff, closed, factory, lastStart, nsBuff, nsStack`

Constructor Summary
`StreamEventWriter(File file)` Constructs a new `StreamEventWriter` that writes to a file.
`StreamEventWriter(OutputStream os)` Constructs a new `StreamEventWriter` that writes to a binary stream.
`StreamEventWriter(Writer writer)` Constructs a new `StreamEventWriter` that writes to a character stream.

Method Summary
`void` `flush()`
`protected void` `sendEvent(XMLEvent event)` Called by the methods of this class to write the event to the stream.

Methods inherited from class javanet.staxutils.BaseXMLEventWriter
`add, add, cacheAttribute, cacheNamespace, close, getNamespaceContext, getPrefix, peekNamespaceStack, popNamespaceStack, pushNamespaceStack, setDefaultNamespace, setNamespaceContext, setPrefix`

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

Constructor Detail

### StreamEventWriter

    public StreamEventWriter(File file)
                      throws IOException

  Constructs a new `StreamEventWriter` that writes to a file.

  Parameters:
    `file` - The file to write.
  Throws:
    `IOException` - If the file couldn't be opened.

### StreamEventWriter

    public StreamEventWriter(OutputStream os)

  Constructs a new `StreamEventWriter` that writes to a binary stream.

  Parameters:
    `os` - The stream to write.

### StreamEventWriter

    public StreamEventWriter(Writer writer)

  Constructs a new `StreamEventWriter` that writes to a character stream.

  Parameters:
    `writer` - The stream to write.

Method Detail

### flush

    public void flush()
               throws XMLStreamException

  Specified by:
    `flush` in interface `XMLEventWriter`
  Overrides:
    `flush` in class `BaseXMLEventWriter`
  Throws:
    `XMLStreamException`

### sendEvent

    protected void sendEvent(XMLEvent event)
                      throws XMLStreamException

  Description copied from class: `BaseXMLEventWriter`
  Called by the methods of this class to write the event to the stream.

  Specified by:
    `sendEvent` in class `BaseXMLEventWriter`
  Parameters:
    `event` - The event to write.
  Throws:
    `XMLStreamException` - If an error occurs processing the event.