com.sun.xml.ws.message
Class JAXBAttachment

java.lang.Object
  extended by com.sun.xml.ws.message.JAXBAttachment
All Implemented Interfaces:
Attachment, javax.activation.DataSource

public final class JAXBAttachment
extends java.lang.Object
implements Attachment, javax.activation.DataSource


Constructor Summary
JAXBAttachment(java.lang.String contentId, java.lang.Object jaxbObject, XMLBridge bridge, java.lang.String mimeType)
           
 
Method Summary
 byte[] asByteArray()
          Gets the attachment as an exact-length byte array.
 javax.activation.DataHandler asDataHandler()
          Gets the attachment as a DataHandler.
 java.io.InputStream asInputStream()
          Obtains this attachment as an InputStream.
 javax.xml.transform.Source asSource()
          Gets the attachment as a Source.
 java.lang.String getContentId()
          Content ID of the attachment.
 java.lang.String getContentType()
          Gets the MIME content-type of this attachment.
 java.io.InputStream getInputStream()
           
 java.lang.String getName()
           
 java.io.OutputStream getOutputStream()
           
 void writeTo(java.io.OutputStream os)
          Writes the contents of the attachment into the given stream.
 void writeTo(javax.xml.soap.SOAPMessage saaj)
          Writes this attachment to the given SOAPMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAXBAttachment

public JAXBAttachment(@NotNull
                      java.lang.String contentId,
                      java.lang.Object jaxbObject,
                      XMLBridge bridge,
                      java.lang.String mimeType)
Method Detail

getContentId

public java.lang.String getContentId()
Description copied from interface: Attachment
Content ID of the attachment. Uniquely identifies an attachment. http://www.ietf.org/rfc/rfc2392.txt (which is referred by the ws-i attachment profile http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html) content-id = url-addr-spec url-addr-spec = addr-spec ; URL encoding of RFC 822 addr-spec cid-url = "cid" ":" content-id A "cid" URL is converted to the corresponding Content-ID message header [MIME] by removing the "cid:" prefix, converting the % encoded character to their equivalent US-ASCII characters, and enclosing the remaining parts with an angle bracket pair, "<" and ">". For example, "cid:foo4%[email protected]" corresponds to Content-ID:

Specified by:
getContentId in interface Attachment
Returns:
The content ID like "[email protected]", without surrounding '<' and '>' used as the transfer syntax.

getContentType

public java.lang.String getContentType()
Description copied from interface: Attachment
Gets the MIME content-type of this attachment.

Specified by:
getContentType in interface Attachment
Specified by:
getContentType in interface javax.activation.DataSource

asByteArray

public byte[] asByteArray()
Description copied from interface: Attachment
Gets the attachment as an exact-length byte array.

Specified by:
asByteArray in interface Attachment

asDataHandler

public javax.activation.DataHandler asDataHandler()
Description copied from interface: Attachment
Gets the attachment as a DataHandler.

Specified by:
asDataHandler in interface Attachment

asSource

public javax.xml.transform.Source asSource()
Description copied from interface: Attachment
Gets the attachment as a Source. Note that there's no guarantee that the attachment is actually an XML.

Specified by:
asSource in interface Attachment

asInputStream

public java.io.InputStream asInputStream()
Description copied from interface: Attachment
Obtains this attachment as an InputStream.

Specified by:
asInputStream in interface Attachment

writeTo

public void writeTo(java.io.OutputStream os)
             throws java.io.IOException
Description copied from interface: Attachment
Writes the contents of the attachment into the given stream.

Specified by:
writeTo in interface Attachment
Throws:
java.io.IOException

writeTo

public void writeTo(javax.xml.soap.SOAPMessage saaj)
             throws javax.xml.soap.SOAPException
Description copied from interface: Attachment
Writes this attachment to the given SOAPMessage.

Specified by:
writeTo in interface Attachment
Throws:
javax.xml.soap.SOAPException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Specified by:
getInputStream in interface javax.activation.DataSource
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Specified by:
getOutputStream in interface javax.activation.DataSource
Throws:
java.io.IOException

getName

public java.lang.String getName()
Specified by:
getName in interface javax.activation.DataSource


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.