Class MtomCodec.MtomStreamWriterImpl
- java.lang.Object
-
- com.sun.xml.ws.util.xml.XMLStreamWriterFilter
-
- com.sun.xml.ws.encoding.MtomCodec.MtomStreamWriterImpl
-
- All Implemented Interfaces:
XMLStreamWriterFactory.RecycleAware,HasEncoding,XMLStreamWriter,MtomStreamWriter,XMLStreamWriterEx
- Enclosing class:
- MtomCodec
public static class MtomCodec.MtomStreamWriterImpl extends XMLStreamWriterFilter implements XMLStreamWriterEx, MtomStreamWriter, HasEncoding
-
-
Field Summary
-
Fields inherited from class com.sun.xml.ws.util.xml.XMLStreamWriterFilter
writer
-
-
Constructor Summary
Constructors Constructor Description MtomStreamWriterImpl(XMLStreamWriter w, List<MtomCodec.ByteArrayBuffer> mtomAttachments, String b, javax.xml.ws.soap.MTOMFeature myMtomFeature)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.bind.attachment.AttachmentMarshallergetAttachmentMarshaller()JAXBMessage writes envelope directly to the OutputStream(for SJSXP, woodstox).StringgetEncoding()List<MtomCodec.ByteArrayBuffer>getMtomAttachments()NamespaceContextExgetNamespaceContext()ObjectgetProperty(String name)voidwriteBinary(byte[] data, int start, int len, String contentType)Write the binary data.OutputStreamwriteBinary(String contentType)Writes the binary data.voidwriteBinary(javax.activation.DataHandler dataHandler)Writes the binary data.voidwritePCDATA(CharSequence data)Writes likeXMLStreamWriter.writeCharacters(String)but hides actual data format.-
Methods inherited from class com.sun.xml.ws.util.xml.XMLStreamWriterFilter
close, flush, getPrefix, onRecycled, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEndElement, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement, writeStartElement, writeStartElement
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.xml.stream.XMLStreamWriter
close, flush, getPrefix, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEndElement, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement, writeStartElement, writeStartElement
-
-
-
-
Constructor Detail
-
MtomStreamWriterImpl
public MtomStreamWriterImpl(XMLStreamWriter w, List<MtomCodec.ByteArrayBuffer> mtomAttachments, String b, javax.xml.ws.soap.MTOMFeature myMtomFeature)
-
-
Method Detail
-
writeBinary
public void writeBinary(byte[] data, int start, int len, String contentType) throws XMLStreamExceptionDescription copied from interface:XMLStreamWriterExWrite 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.
- Specified by:
writeBinaryin interfaceXMLStreamWriterExcontentType- this mandatory parameter identifies the MIME type of the binary data. If the MIME type isn't known by the caller, "application/octet-stream" can be always used to indicate "I don't know." Never null.- Throws:
XMLStreamException
-
writeBinary
public void writeBinary(javax.activation.DataHandler dataHandler) throws XMLStreamExceptionDescription copied from interface:XMLStreamWriterExWrites the binary data.This method works like the
XMLStreamWriterEx.writeBinary(byte[], int, int, String)method, except that it takes the binary data in the form ofDataHandler, which contains a MIME type (DataHandler.getContentType()as well as the payloadDataHandler.getInputStream().- Specified by:
writeBinaryin interfaceXMLStreamWriterEx- Parameters:
dataHandler- always non-null. After this method call, the callee owns the data handler.- Throws:
XMLStreamException
-
writeBinary
public OutputStream writeBinary(String contentType) throws XMLStreamException
Description copied from interface:XMLStreamWriterExWrites the binary data.This version of the writeBinary method allows the caller to produce the binary data by writing it to
OutputStream.It is the caller's responsibility to write and close a stream before it invokes any other methods on
XMLStreamWriter. TODO: experimental. appreciate feedback- Specified by:
writeBinaryin interfaceXMLStreamWriterEx- Parameters:
contentType- See the content-type parameter ofXMLStreamWriterEx.writeBinary(byte[], int, int, String). Must not be null.- Returns:
- always return a non-null
OutputStream. - Throws:
XMLStreamException
-
writePCDATA
public void writePCDATA(CharSequence data) throws XMLStreamException
Description copied from interface:XMLStreamWriterExWrites likeXMLStreamWriter.writeCharacters(String)but hides actual data format.- Specified by:
writePCDATAin interfaceXMLStreamWriterEx- Parameters:
data- TheCharSequencethat represents the character infoset items to be written.The
CharSequenceis normally aString, but can be any otherCharSequenceimplementation. For binary data, however, use ofBase64Datais recommended (so that the consumer interested in seeing it as binary data may take advantage of mor efficient data representation.)- Throws:
XMLStreamException
-
getProperty
public Object getProperty(String name) throws IllegalArgumentException
- Specified by:
getPropertyin interfaceXMLStreamWriter- Overrides:
getPropertyin classXMLStreamWriterFilter- Throws:
IllegalArgumentException
-
getAttachmentMarshaller
public javax.xml.bind.attachment.AttachmentMarshaller getAttachmentMarshaller()
JAXBMessage writes envelope directly to the OutputStream(for SJSXP, woodstox). While writing, it calls the AttachmentMarshaller methods for adding attachments. JAXB writes xop:Include in this case.- Specified by:
getAttachmentMarshallerin interfaceMtomStreamWriter
-
getMtomAttachments
public List<MtomCodec.ByteArrayBuffer> getMtomAttachments()
-
getEncoding
public String getEncoding()
- Specified by:
getEncodingin interfaceHasEncoding
-
getNamespaceContext
public NamespaceContextEx getNamespaceContext()
Description copied from interface:XMLStreamWriterEx- Specified by:
getNamespaceContextin interfaceXMLStreamWriter- Specified by:
getNamespaceContextin interfaceXMLStreamWriterEx- Overrides:
getNamespaceContextin classXMLStreamWriterFilter
-
-