Package com.boomi.connector.util.xml
Class XMLJoiner
- java.lang.Object
-
- com.boomi.connector.util.xml.XMLEventUtilBase
-
- com.boomi.connector.util.xml.XMLJoiner
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class XMLJoiner extends XMLEventUtilBase implements Closeable, Flushable
Utility for efficiently joining/wrapping multiple xml documents into one xml document. Provides a variety of customization points for altering the content of the output data (seestartDocument()
,endDocument()
,findObjectStart()
,XMLEventUtilBase.addObjectEvent(javax.xml.stream.events.XMLEvent)
, andXMLEventUtilBase.finishObject()
). This class must be closed before the stream will be completely written (and to free underlying resources).
-
-
Field Summary
-
Fields inherited from class com.boomi.connector.util.xml.XMLEventUtilBase
logger, NAMESPACE_AWARE_PROP, REPAIR_NAMESPACE_PROP
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLJoiner()
protected
XMLJoiner(XMLEventWriter writer)
protected
XMLJoiner(XMLEventWriter writer, XMLInputFactory inFactory)
protected
XMLJoiner(XMLInputFactory inFactory, XMLOutputFactory outFactory)
protected
XMLJoiner(XMLOutputFactory outFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeImpl()
Does the actual close work for this instance, will only be called once.protected void
endDocument()
Called after all object events have been written to the writer.protected XMLEvent
findObjectStart()
Finds the first event for the start of the next input object from the current reader.void
flush()
protected void
initialize()
protected void
startDocument()
Called before any events are written to the writer.void
write(ObjectData data)
Writes the given ObjectData to the xml output writer.void
write(InputStream in)
Writes the given InputStream to the xml output writer.void
writeAll(Iterable<ObjectData> datas)
Writes all of the ObjectDatas to the xml output writer.-
Methods inherited from class com.boomi.connector.util.xml.XMLEventUtilBase
addObjectEvent, close, closeQuietly, closeReader, closeWriter, createEventFactory, createInputFactory, createInputFactory, createOutputFactory, createOutputFactory, findNextElementStart, finishObject, getEventFactory, getInputFactory, getOutputFactory, getReader, getWriter, openReader, openWriter, setReader, setWriter, startObject
-
-
-
-
Constructor Detail
-
XMLJoiner
protected XMLJoiner()
-
XMLJoiner
protected XMLJoiner(XMLOutputFactory outFactory)
-
XMLJoiner
protected XMLJoiner(XMLEventWriter writer)
-
XMLJoiner
protected XMLJoiner(XMLEventWriter writer, XMLInputFactory inFactory)
-
XMLJoiner
protected XMLJoiner(XMLInputFactory inFactory, XMLOutputFactory outFactory)
-
-
Method Detail
-
initialize
protected void initialize() throws XMLStreamException
- Throws:
XMLStreamException
-
writeAll
public void writeAll(Iterable<ObjectData> datas)
Writes all of the ObjectDatas to the xml output writer.- Parameters:
datas
- collection of ObjectDatas to be written, may benull
-
write
public void write(ObjectData data)
Writes the given ObjectData to the xml output writer.- Parameters:
data
- an individual ObjectData to write, may benull
-
write
public void write(InputStream in)
Writes the given InputStream to the xml output writer.- Parameters:
in
- an InputStream to write, may benull
-
startDocument
protected void startDocument() throws XMLStreamException
Called before any events are written to the writer. Subclasses may override this to add additional prologue events to the writer.Base class writes a start-document event.
- Throws:
XMLStreamException
-
endDocument
protected void endDocument() throws XMLStreamException
Called after all object events have been written to the writer. Subclasses may override this to add additional epilogue events to the writer.Base class does nothing.
- Throws:
XMLStreamException
-
findObjectStart
protected XMLEvent findObjectStart() throws XMLStreamException
Finds the first event for the start of the next input object from the current reader.Default implementation returns the first start-element event.
- Returns:
- the first event for the next object, or
null
if there is no object in the reader - Throws:
XMLStreamException
-
closeImpl
protected void closeImpl()
Description copied from class:XMLEventUtilBase
Does the actual close work for this instance, will only be called once.- Specified by:
closeImpl
in classXMLEventUtilBase
-
-