public interface DataHandlerWriter
XMLStreamWriter
implementations that can
receive base64 encoded binary content as DataHandler
objects. A stream writer
implementing this extension may write the binary data as base64 encoded character data
or using some optimization such as XOP/MTOM.
All the requirements specified in org.apache.axiom.ext.stax
apply to
this extension interface. In particular,
a consumer MUST use XMLStreamWriter.getProperty(String)
with the property
name defined by PROPERTY
to get a reference to this extension interface.
The interface defines two methods to write binary content, one that takes a DataHandler
argument and one with a DataHandlerProvider
argument. The first should be used when
the content is immediately available, while the second supports deferred loading of the data
handler. The meaning of the contentID
and optimize
arguments is
the same for both methods:
contentID
DataHandlerReader.getContentID()
method:
optimize
XMLStreamWriterUtils.writeDataHandler(javax.xml.stream.XMLStreamWriter, DataHandler, String, boolean)
or
XMLStreamWriterUtils.writeDataHandler(javax.xml.stream.XMLStreamWriter, DataHandlerProvider, String, boolean)
utility methods. These methods make the processing of binary data entirely transparent for
the caller.Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY
The name of the property used to look up this extension interface from a
XMLStreamWriter implementation. |
Modifier and Type | Method and Description |
---|---|
void |
writeDataHandler(DataHandlerProvider dataHandlerProvider,
String contentID,
boolean optimize)
Write binary content to the stream.
|
void |
writeDataHandler(javax.activation.DataHandler dataHandler,
String contentID,
boolean optimize)
Write binary content to the stream.
|
static final String PROPERTY
XMLStreamWriter
implementation.void writeDataHandler(javax.activation.DataHandler dataHandler, String contentID, boolean optimize) throws IOException, javax.xml.stream.XMLStreamException
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)IOException
- if an error occurs while reading from the data handlerjavax.xml.stream.XMLStreamException
- if an error occurs while writing to the underlying streamvoid writeDataHandler(DataHandlerProvider dataHandlerProvider, String contentID, boolean optimize) throws IOException, javax.xml.stream.XMLStreamException
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)IOException
- If an error occurs while reading from the data handler. Since the implementation
is free to override the supplied optimize
argument, it may attempt
to load the binary data immediately. Because this operation may fail, the method
must declare this exception.javax.xml.stream.XMLStreamException
- if an error occurs while writing to the underlying streamCopyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.