public class StreamEventWriter extends BaseXMLEventWriter
XMLEventWriter
that writes events to a character stream
using XMLEvent.writeAsEncodedUnicode(Writer)
.Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
void |
flush() |
protected void |
sendEvent(javax.xml.stream.events.XMLEvent event)
Called by the methods of this class to write the event to the stream.
|
add, add, cacheAttribute, cacheNamespace, close, getNamespaceContext, getPrefix, peekNamespaceStack, popNamespaceStack, pushNamespaceStack, setDefaultNamespace, setNamespaceContext, setPrefix
public StreamEventWriter(java.io.File file) throws java.io.IOException
StreamEventWriter
that writes to a file.file
- The file to write.java.io.IOException
- If the file couldn't be opened.public StreamEventWriter(java.io.OutputStream os)
StreamEventWriter
that writes to a binary
stream.os
- The stream to write.public StreamEventWriter(java.io.Writer writer)
StreamEventWriter
that writes to a character
stream.writer
- The stream to write.public void flush() throws javax.xml.stream.XMLStreamException
flush
in interface javax.xml.stream.XMLEventWriter
flush
in class BaseXMLEventWriter
javax.xml.stream.XMLStreamException
protected void sendEvent(javax.xml.stream.events.XMLEvent event) throws javax.xml.stream.XMLStreamException
BaseXMLEventWriter
sendEvent
in class BaseXMLEventWriter
event
- The event to write.javax.xml.stream.XMLStreamException
- If an error occurs processing the event.