Extension interface for {@link javax.xml.stream.XMLStreamWriter} implementations that canreceive base64 encoded binary content as {@link DataHandler} objects. A stream writerimplementing 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 {@link org.apache.axiom.ext.stax} apply tothis extension interface. In particular, a consumer MUST use {@link javax.xml.stream.XMLStreamWriter#getProperty(String)} with the propertyname defined by {@link #PROPERTY} to get a reference to this extension interface.
The interface defines two methods to write binary content, one that takes a {@link DataHandler}argument and one with a {@link DataHandlerProvider} argument. The first should be used whenthe 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
- A content ID of the binary content, if available. The semantics of this argument are similar to those defined for the return value of the {@link DataHandlerReader#getContentID()} method:
- This argument should only be set if a content ID has been used previously in an interaction with another component or system. The caller SHOULD NOT generate a new content ID solely for the purpose of invoking the extension.
- The argument must be a raw content ID.
- The implementation MUST NOT make any assumption about the uniqueness or validity of the content ID. It MAY ignore the supplied value.
optimize
- Specifies if binary content is eligible for optimization (e.g. using XOP) or if it should be serialized as base64. This is only an indication and the implementation MAY choose to override this value or ignore it entirely.
Instead of interacting directly with this extension interface, the consumer may use the {@link org.apache.axiom.util.stax.XMLStreamWriterUtils#writeDataHandler(javax.xml.stream.XMLStreamWriter,DataHandler,String,boolean)} or{@link org.apache.axiom.util.stax.XMLStreamWriterUtils#writeDataHandler(javax.xml.stream.XMLStreamWriter,DataHandlerProvider,String,boolean)}utility methods. These methods make the processing of binary data entirely transparent for the caller.