public class MTOMXMLStreamWriter extends Object implements XMLStreamWriter
| Constructor and Description |
|---|
MTOMXMLStreamWriter(OutputStream outStream,
OMOutputFormat format) |
MTOMXMLStreamWriter(OutputStream outStream,
OMOutputFormat format,
boolean preserveAttachments)
Creates a new MTOMXMLStreamWriter with specified encoding.
|
MTOMXMLStreamWriter(XMLStreamWriter xmlWriter) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush()
Flush is overridden to trigger the attachment serialization
|
String |
getCharSetEncoding()
Returns the character set encoding scheme.
|
String |
getContentType() |
String |
getMimeBoundary() |
NamespaceContext |
getNamespaceContext() |
String |
getNextContentId() |
OMOutputFormat |
getOutputFormat()
Get the output format used by this writer.
|
OutputStream |
getOutputStream()
Get the underlying
OutputStream for this writer, if available. |
String |
getPrefix(String string) |
Object |
getProperty(String string) |
String |
getRootContentId() |
XMLStreamWriter |
getXmlStreamWriter() |
String |
getXmlVersion() |
boolean |
isIgnoreXMLDeclaration() |
boolean |
isOptimized()
Check if MTOM is enabled.
|
boolean |
isOptimizedThreshold(OMText node)
Deprecated.
Serialization code should use
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)
or XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)
to submit any binary content and let this writer decide whether the content should be
written as base64 encoded character data or using xop:Include. If this is not
possible, then prepareDataHandler(DataHandler) should be used.
All the aforementioned methods take into account the settings defined in
OMOutputFormat to determine whether the binary data should be optimized or not.
Therefore, there is not need for this method anymore. |
String |
prepareDataHandler(DataHandler dataHandler)
Prepare a
DataHandler for serialization without using the DataHandlerWriter
API. |
XMLStreamWriterFilter |
removeFilter() |
void |
setCharSetEncoding(String charSetEncoding) |
void |
setDefaultNamespace(String string) |
void |
setDoOptimize(boolean b) |
void |
setFilter(XMLStreamWriterFilter filter) |
void |
setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) |
void |
setNamespaceContext(NamespaceContext namespaceContext) |
void |
setOutputFormat(OMOutputFormat format) |
void |
setPrefix(String string,
String string1) |
void |
setSoap11(boolean b) |
void |
setXmlStreamWriter(XMLStreamWriter xmlWriter) |
void |
setXmlVersion(String xmlVersion) |
void |
writeAttribute(String string,
String string1) |
void |
writeAttribute(String string,
String string1,
String string2) |
void |
writeAttribute(String string,
String string1,
String string2,
String string3) |
void |
writeCData(String string) |
void |
writeCharacters(char[] chars,
int i,
int i1) |
void |
writeCharacters(String string) |
void |
writeComment(String string) |
void |
writeDefaultNamespace(String string) |
void |
writeDTD(String string) |
void |
writeEmptyElement(String string) |
void |
writeEmptyElement(String string,
String string1) |
void |
writeEmptyElement(String string,
String string1,
String string2) |
void |
writeEndDocument() |
void |
writeEndElement() |
void |
writeEntityRef(String string) |
void |
writeNamespace(String string,
String string1) |
void |
writeOptimized(OMText node)
Deprecated.
Serialization code should use
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)
or XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)
to submit any binary content and let this writer decide whether the content should be
written as base64 encoded character data or using xop:Include. If this is not
possible, then prepareDataHandler(DataHandler) should be used. |
void |
writeProcessingInstruction(String string) |
void |
writeProcessingInstruction(String string,
String string1) |
void |
writeStartDocument() |
void |
writeStartDocument(String string) |
void |
writeStartDocument(String string,
String string1) |
void |
writeStartElement(String string) |
void |
writeStartElement(String string,
String string1) |
void |
writeStartElement(String string,
String string1,
String string2) |
public MTOMXMLStreamWriter(XMLStreamWriter xmlWriter)
public MTOMXMLStreamWriter(OutputStream outStream, OMOutputFormat format) throws XMLStreamException, FactoryConfigurationError
public MTOMXMLStreamWriter(OutputStream outStream, OMOutputFormat format, boolean preserveAttachments) throws XMLStreamException, FactoryConfigurationError
outStream - format - preserveAttachments - specifies whether attachments must be preserved or can be consumed (i.e. streamed)
during serialization; if set to false then
DataHandlerExt.readOnce() or an equivalent method may be used to get the
data for an attachmentXMLStreamExceptionFactoryConfigurationErrorOMOutputFormat.DEFAULT_CHAR_SET_ENCODINGpublic void writeStartElement(String string) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String string, String string1) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String string, String string1, String string2) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String string, String string1) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String string, String string1, String string2) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String string) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndElement()
throws XMLStreamException
writeEndElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndDocument()
throws XMLStreamException
writeEndDocument in interface XMLStreamWriterXMLStreamExceptionpublic void close()
throws XMLStreamException
close in interface XMLStreamWriterXMLStreamExceptionpublic void flush()
throws XMLStreamException
flush in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String string, String string1) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String string, String string1, String string2, String string3) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String string, String string1, String string2) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeNamespace(String string, String string1) throws XMLStreamException
writeNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeDefaultNamespace(String string) throws XMLStreamException
writeDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeComment(String string) throws XMLStreamException
writeComment in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String string) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String string, String string1) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeCData(String string) throws XMLStreamException
writeCData in interface XMLStreamWriterXMLStreamExceptionpublic void writeDTD(String string) throws XMLStreamException
writeDTD in interface XMLStreamWriterXMLStreamExceptionpublic void writeEntityRef(String string) throws XMLStreamException
writeEntityRef in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument()
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String string) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String string, String string1) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(String string) throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(char[] chars,
int i,
int i1)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic String getPrefix(String string) throws XMLStreamException
getPrefix in interface XMLStreamWriterXMLStreamExceptionpublic void setPrefix(String string, String string1) throws XMLStreamException
setPrefix in interface XMLStreamWriterXMLStreamExceptionpublic void setDefaultNamespace(String string) throws XMLStreamException
setDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException
setNamespaceContext in interface XMLStreamWriterXMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLStreamWriterpublic Object getProperty(String string) throws IllegalArgumentException
getProperty in interface XMLStreamWriterIllegalArgumentExceptionpublic boolean isOptimized()
Note that serialization code should use
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)
or
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)
to submit any binary content and let this writer decide whether the content should be written
as base64 encoded character data or using xop:Include. This makes optimization
entirely transparent for the caller and there should be no need to check if the writer is
producing MTOM. However, in some cases this is not possible, such as when integrating with
3rd party libraries. The serialization code should then use
prepareDataHandler(DataHandler) so that it can write xop:Include elements
directly to the stream. In that case, the code may use the isOptimized() method
check if MTOM is enabled at all.
true if MTOM is enabled, false otherwisepublic String getContentType()
public void writeOptimized(OMText node)
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)
or XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)
to submit any binary content and let this writer decide whether the content should be
written as base64 encoded character data or using xop:Include. If this is not
possible, then prepareDataHandler(DataHandler) should be used.public boolean isOptimizedThreshold(OMText node)
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)
or XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)
to submit any binary content and let this writer decide whether the content should be
written as base64 encoded character data or using xop:Include. If this is not
possible, then prepareDataHandler(DataHandler) should be used.
All the aforementioned methods take into account the settings defined in
OMOutputFormat to determine whether the binary data should be optimized or not.
Therefore, there is not need for this method anymore.public String prepareDataHandler(DataHandler dataHandler)
DataHandler for serialization without using the DataHandlerWriter
API. The method first determines whether the binary data represented by the
DataHandler should be optimized or inlined. If the data should not be optimized, then
the method returns null and the caller is expected to use
writeCharacters(String) or writeCharacters(char[], int, int) to write the
base64 encoded data to the stream. If the data should be optimized, then the method returns a
content ID and the caller is expected to generate an xop:Include element referring
to that content ID.
This method should only be used to integrate Axiom with third party libraries that support
XOP. In all other cases,
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)
or
XMLStreamWriterUtils.writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)
should be used to write base64Binary values and the application code should never generate
xop:Include elements itself.
dataHandler - the DataHandler that the caller intends to write to the streamnull if the base64 encoded data should not be optimizedpublic void setXmlStreamWriter(XMLStreamWriter xmlWriter)
public XMLStreamWriter getXmlStreamWriter()
public String getMimeBoundary()
public String getRootContentId()
public String getNextContentId()
public String getCharSetEncoding()
public void setCharSetEncoding(String charSetEncoding)
public String getXmlVersion()
public void setXmlVersion(String xmlVersion)
public void setSoap11(boolean b)
public boolean isIgnoreXMLDeclaration()
public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration)
public void setDoOptimize(boolean b)
public OMOutputFormat getOutputFormat()
The caller should use the returned instance in a read-only way, i.e. he should not modify the settings of the output format. Any attempt to do so will lead to unpredictable results.
public void setOutputFormat(OMOutputFormat format)
public OutputStream getOutputStream() throws XMLStreamException
OutputStream for this writer, if available. This method allows a
node (perhaps an OMSourcedElement) to write its content directly
to the byte stream.
WARNING: This method should be used with extreme care. The caller must be prepared to handle the following issues:
null if the stream is not accessibleXMLStreamExceptionpublic void setFilter(XMLStreamWriterFilter filter)
public XMLStreamWriterFilter removeFilter()
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.