| org.jvnet.staxex.XMLStreamWriterEx
XMLStreamWriterEx | public interface XMLStreamWriterEx extends XMLStreamWriter(Code) | | XMLStreamWriter extended to support XOP.
Some infoset serializer (such as XOP encoder, FastInfoset) uses a format
that can represent binary data more efficiently than base64 encoding.
Such infoset serializer may choose to implement this interface, to allow
the caller to pass in binary data more efficiently without first converting
it to binary data.
Callers capable of using this interface can see if the serializer supports
it by simply downcasting
XMLStreamWriter to
XMLStreamWriterEx .
TODO
-
Add methods to write other primitive types, such as hex and integers
(and arrays of).
A textual implementation would write characters in accordance
to the canonical lexical definitions specified in W3C XML Schema: datatypes.
A MTOM implementation would write characters except for the case where octets
that would otherwise be base64 encoded when using the textual implementation.
A Fast Infoset implementation would encoded binary data the primitive types in
binary form.
-
Consider renaming writeBinary to writeBytesAsBase64 to be consistent with
infoset abstraction.
-
Add the ability to writeStart and writeEnd on attributes so that the same
methods for writing primitive types (and characters, which will require new methods)
can be used for writing attribute values as well as element content.
See Also: XMLStreamReaderEx author: Kohsuke Kawaguchi author: Paul Sandoz |
writeBinary | void writeBinary(byte[] data, int start, int len, String contentType) throws XMLStreamException(Code) | | Write the binary data.
Conceptually (infoset-wise), this produces the base64-encoded binary data on the
output. But this allows implementations like FastInfoset or XOP to do the smart
thing.
The use of this method has some restriction to support XOP. Namely, this method
must be invoked as a sole content of an element.
(data,start,len) triplet identifies the binary data to be written.
After the method invocation, the callee owns the buffer.
Parameters: contentType - this mandatory parameter identifies the MIME type of the binary data.If the MIME type isn't known by the caller, "application/octet-stream" canbe always used to indicate "I don't know." Never null. |
|
|