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
Constructor Summary |
StreamEventWriter(java.io.File file)
Constructs a new StreamEventWriter that writes to a file. |
StreamEventWriter(java.io.OutputStream os)
Constructs a new StreamEventWriter that writes to a binary
stream. |
StreamEventWriter(java.io.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 |
StreamEventWriter
public StreamEventWriter(java.io.File file)
throws java.io.IOException
- Constructs a new
StreamEventWriter
that writes to a file.
- Parameters:
file
- The file to write.
- Throws:
java.io.IOException
- If the file couldn't be opened.
StreamEventWriter
public StreamEventWriter(java.io.OutputStream os)
- Constructs a new
StreamEventWriter
that writes to a binary
stream.
- Parameters:
os
- The stream to write.
StreamEventWriter
public StreamEventWriter(java.io.Writer writer)
- Constructs a new
StreamEventWriter
that writes to a character
stream.
- Parameters:
writer
- The stream to write.
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.