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 protectedXMLJoiner()protectedXMLJoiner(XMLEventWriter writer)protectedXMLJoiner(XMLEventWriter writer, XMLInputFactory inFactory)protectedXMLJoiner(XMLInputFactory inFactory, XMLOutputFactory outFactory)protectedXMLJoiner(XMLOutputFactory outFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseImpl()Does the actual close work for this instance, will only be called once.protected voidendDocument()Called after all object events have been written to the writer.protected XMLEventfindObjectStart()Finds the first event for the start of the next input object from the current reader.voidflush()protected voidinitialize()protected voidstartDocument()Called before any events are written to the writer.voidwrite(ObjectData data)Writes the given ObjectData to the xml output writer.voidwrite(InputStream in)Writes the given InputStream to the xml output writer.voidwriteAll(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 XMLStreamExceptionCalled 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 XMLStreamExceptionCalled 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
nullif there is no object in the reader - Throws:
XMLStreamException
-
closeImpl
protected void closeImpl()
Description copied from class:XMLEventUtilBaseDoes the actual close work for this instance, will only be called once.- Specified by:
closeImplin classXMLEventUtilBase
-
-