public class XmlEventReaderToWriter
extends java.lang.Object
Used to connect XmlEventReader
and XmlEventWriter
objects,
pushing the events from XmlEventReader
to the writer.
You can obtain an instance of XmlEventWriter
using
XmlContainer.putDocumentAsEventWriter(com.sleepycat.dbxml.XmlDocument)
. You can obtain an
instance of XmlEventReader
using a combination of XmlContainer.getDocument(java.lang.String)
and XmlDocument.getContentAsEventReader()
.
This class provides an efficient mechanism to copy the content from one document to another, directly.
Constructor and Description |
---|
XmlEventReaderToWriter(XmlEventReader reader,
XmlEventWriter writer,
boolean ownsReader)
Construct an
XmlEventReaderToWriter instance from the parameters. |
XmlEventReaderToWriter(XmlEventReader reader,
XmlEventWriter writer,
boolean ownsReader,
boolean ownsWriter)
Construct an
XmlEventReaderToWriter instance from the parameters. |
Modifier and Type | Method and Description |
---|---|
void |
start()
Perform the operation.
|
public XmlEventReaderToWriter(XmlEventReader reader, XmlEventWriter writer, boolean ownsReader) throws XmlException
XmlEventReaderToWriter
instance from the parameters.reader
- The XmlEventReader
from which events are read.writer
- The XmlEventWriter
to which events are written. This object is
always donated, and the caller can no longer use it.ownsReader
- Set to true if the reader is donated to the object, which means the
constructed object is responsible for calling XmlEventReader.close()
.XmlException
public XmlEventReaderToWriter(XmlEventReader reader, XmlEventWriter writer, boolean ownsReader, boolean ownsWriter) throws XmlException
XmlEventReaderToWriter
instance from the parameters.reader
- The XmlEventReader
from which events are read.writer
- The XmlEventWriter
to which events are written. This object is
always donated, and the caller can no longer use it.ownsReader
- Set to true if the reader is donated to the object, which means the
constructed object is responsible for calling XmlEventReader.close()
.ownsWriter
- Set to true if the writer is donated to the object, which means the
constructed object is responsible for calling XmlEventWriter.close()
.XmlException
public void start() throws XmlException
XmlEventWriter.close()
and, if ownsReader was true during
construction, XmlEventReader.close()
.XmlException
Copyright (c) 2004,2014 Oracle. All rights reserved.