Package org.apache.axiom.util.stax.xop
Class XOPEncodingStreamWriter
java.lang.Object
org.apache.axiom.util.stax.xop.XOPEncodingStreamWrapper
org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter
- All Implemented Interfaces:
XMLStreamWriter,DataHandlerWriter,MimePartProvider
public class XOPEncodingStreamWriter
extends XOPEncodingStreamWrapper
implements XMLStreamWriter, DataHandlerWriter
XMLStreamWriter wrapper that encodes XOP. It implements the extension
defined by DataHandlerWriter. The DataHandler
objects for the parts referenced by xop:Include element information items produced by
an instance of this class can be retrieved using the XOPEncodingStreamWrapper.getDataHandler(String) method.-
Field Summary
Fields inherited from interface org.apache.axiom.ext.stax.datahandler.DataHandlerWriter
PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionXOPEncodingStreamWriter(XMLStreamWriter parent, ContentIDGenerator contentIDGenerator, OptimizationPolicy optimizationPolicy) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()getProperty(String name) voidvoidsetNamespaceContext(NamespaceContext context) voidvoidwriteAttribute(String localName, String value) voidwriteAttribute(String namespaceURI, String localName, String value) voidwriteAttribute(String prefix, String namespaceURI, String localName, String value) voidwriteCData(String data) voidwriteCharacters(char[] text, int start, int len) voidwriteCharacters(String text) voidwriteComment(String data) voidwriteDataHandler(DataHandler dataHandler, String contentID, boolean optimize) Write binary content to the stream.voidwriteDataHandler(DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) Write binary content to the stream.voidwriteDefaultNamespace(String namespaceURI) voidvoidwriteEmptyElement(String localName) voidwriteEmptyElement(String namespaceURI, String localName) voidwriteEmptyElement(String prefix, String localName, String namespaceURI) voidvoidvoidwriteEntityRef(String name) voidwriteNamespace(String prefix, String namespaceURI) voidwriteProcessingInstruction(String target) voidwriteProcessingInstruction(String target, String data) voidvoidwriteStartDocument(String version) voidwriteStartDocument(String encoding, String version) voidwriteStartElement(String localName) voidwriteStartElement(String namespaceURI, String localName) voidwriteStartElement(String prefix, String localName, String namespaceURI) Methods inherited from class org.apache.axiom.util.stax.xop.XOPEncodingStreamWrapper
getContentIDs, getDataHandler, isLoaded, processDataHandler, processDataHandler
-
Constructor Details
-
XOPEncodingStreamWriter
public XOPEncodingStreamWriter(XMLStreamWriter parent, ContentIDGenerator contentIDGenerator, OptimizationPolicy optimizationPolicy) Constructor.- Parameters:
parent- the XML stream to write the encoded infoset tocontentIDGenerator- used to generate content IDs for the binary content encoded as xop:Include element information itemsoptimizationPolicy- the policy to apply to decide which binary content to optimize
-
-
Method Details
-
getProperty
- Specified by:
getPropertyin interfaceXMLStreamWriter- Throws:
IllegalArgumentException
-
writeDataHandler
public void writeDataHandler(DataHandler dataHandler, String contentID, boolean optimize) throws IOException, XMLStreamException Description copied from interface:DataHandlerWriterWrite binary content to the stream. The implementation may choose to write the data as base64 encoded character data or using an optimization protocol such as XOP/MTOM.- Specified by:
writeDataHandlerin interfaceDataHandlerWriter- Parameters:
dataHandler- the binary content to writecontentID- an existing content ID for the binary data (see above)optimize- indicates whether the content is eligible for optimization (see above)- Throws:
IOException- if an error occurs while reading from the data handlerXMLStreamException- if an error occurs while writing to the underlying stream
-
writeDataHandler
public void writeDataHandler(DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) throws IOException, XMLStreamException Description copied from interface:DataHandlerWriterWrite binary content to the stream. This method allows the implementation to defer loading of the content. More precisely, if the implementation decides to use an optimization scheme such as XOP, then the content will not be written immediately to the underlying stream, but only after the XML infoset is complete. If the caller uses this method, the implementation can defer the actual loading of the binary content.- Specified by:
writeDataHandlerin interfaceDataHandlerWriter- Parameters:
dataHandlerProvider- the binary content to writecontentID- an existing content ID for the binary data (see above)optimize- indicates whether the content is eligible for optimization (see above)- Throws:
IOException- If an error occurs while reading from the data handler. Since the implementation is free to override the suppliedoptimizeargument, it may attempt to load the binary data immediately. Because this operation may fail, the method must declare this exception.XMLStreamException- if an error occurs while writing to the underlying stream
-
close
- Specified by:
closein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
flush
- Specified by:
flushin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
getNamespaceContext
- Specified by:
getNamespaceContextin interfaceXMLStreamWriter
-
getPrefix
- Specified by:
getPrefixin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setDefaultNamespace
- Specified by:
setDefaultNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setNamespaceContext
- Specified by:
setNamespaceContextin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setPrefix
- Specified by:
setPrefixin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
- Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCData
- Specified by:
writeCDatain interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeComment
- Specified by:
writeCommentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeDefaultNamespace
- Specified by:
writeDefaultNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeDTD
- Specified by:
writeDTDin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException - Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEndDocument
- Specified by:
writeEndDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEndElement
- Specified by:
writeEndElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEntityRef
- Specified by:
writeEntityRefin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeNamespace
- Specified by:
writeNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException - Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-