com.sun.xml.security.core.dsig
Class CustomStreamWriterImpl

java.lang.Object
  extended by com.sun.xml.ws.util.xml.XMLStreamWriterFilter
      extended by com.sun.xml.security.core.dsig.CustomStreamWriterImpl
All Implemented Interfaces:
XMLStreamWriterFactory.RecycleAware, MtomStreamWriter, XMLStreamWriter, XMLStreamWriterEx

public class CustomStreamWriterImpl
extends XMLStreamWriterFilter
implements XMLStreamWriterEx, MtomStreamWriter

Author:
suresh

Field Summary
protected  XMLStreamWriterEx sw
           
 
Fields inherited from class com.sun.xml.ws.util.xml.XMLStreamWriterFilter
writer
 
Constructor Summary
CustomStreamWriterImpl(XMLStreamWriter sw)
           
 
Method Summary
 AttachmentMarshaller getAttachmentMarshaller()
           
 NamespaceContextEx getNamespaceContext()
          
 void writeBinary(byte[] arg0, int arg1, int arg2, String arg3)
          Write the binary data.
 void writeBinary(DataHandler dh)
          Writes the binary data.
 OutputStream writeBinary(String arg0)
          Writes the binary data.
 void writePCDATA(CharSequence data)
          Writes like XMLStreamWriter.writeCharacters(String) but hides actual data format.
 
Methods inherited from class com.sun.xml.ws.util.xml.XMLStreamWriterFilter
close, flush, getPrefix, getProperty, 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, getProperty, 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
 

Field Detail

sw

protected XMLStreamWriterEx sw
Constructor Detail

CustomStreamWriterImpl

public CustomStreamWriterImpl(XMLStreamWriter sw)
Method Detail

writeBinary

public void writeBinary(byte[] arg0,
                        int arg1,
                        int arg2,
                        String arg3)
                 throws XMLStreamException
Description copied from interface: XMLStreamWriterEx
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.

Specified by:
writeBinary in interface XMLStreamWriterEx
arg3 - 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(DataHandler dh)
                 throws XMLStreamException
Description copied from interface: XMLStreamWriterEx
Writes 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 of DataHandler, which contains a MIME type (DataHandler.getContentType() as well as the payload DataHandler.getInputStream().

Specified by:
writeBinary in interface XMLStreamWriterEx
Parameters:
dh - always non-null. After this method call, the callee owns the data handler.
Throws:
XMLStreamException

writeBinary

public OutputStream writeBinary(String arg0)
                         throws XMLStreamException
Description copied from interface: XMLStreamWriterEx
Writes 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:
writeBinary in interface XMLStreamWriterEx
Parameters:
arg0 - See the content-type parameter of XMLStreamWriterEx.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: XMLStreamWriterEx
Writes like XMLStreamWriter.writeCharacters(String) but hides actual data format.

Specified by:
writePCDATA in interface XMLStreamWriterEx
Parameters:
data - The CharSequence that represents the character infoset items to be written.

The CharSequence is normally a String, but can be any other CharSequence implementation. For binary data, however, use of Base64Data is recommended (so that the consumer interested in seeing it as binary data may take advantage of mor efficient data representation.)

Throws:
XMLStreamException

getNamespaceContext

public NamespaceContextEx getNamespaceContext()
Description copied from interface: XMLStreamWriterEx

Specified by:
getNamespaceContext in interface XMLStreamWriter
Specified by:
getNamespaceContext in interface XMLStreamWriterEx
Overrides:
getNamespaceContext in class XMLStreamWriterFilter

getAttachmentMarshaller

public AttachmentMarshaller getAttachmentMarshaller()
Specified by:
getAttachmentMarshaller in interface MtomStreamWriter


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.