Package com.sun.xml.ws.message
Class ByteArrayAttachment
- java.lang.Object
-
- com.sun.xml.ws.message.ByteArrayAttachment
-
- All Implemented Interfaces:
Attachment
public final class ByteArrayAttachment extends Object implements Attachment
- Author:
- Jitendra Kotamraju
-
-
Constructor Summary
Constructors Constructor Description ByteArrayAttachment(String contentId, byte[] data, int start, int len, String mimeType)ByteArrayAttachment(String contentId, byte[] data, String mimeType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]asByteArray()Gets the attachment as an exact-length byte array.jakarta.activation.DataHandlerasDataHandler()Gets the attachment as aDataHandler.InputStreamasInputStream()Obtains this attachment as anInputStream.SourceasSource()Gets the attachment as aSource.StringgetContentId()Content ID of the attachment.StringgetContentType()Gets the MIME content-type of this attachment.voidwriteTo(jakarta.xml.soap.SOAPMessage saaj)Writes this attachment to the givenSOAPMessage.voidwriteTo(OutputStream os)Writes the contents of the attachment into the given stream.
-
-
-
Method Detail
-
getContentId
public String getContentId()
Description copied from interface:AttachmentContent 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%25foo1@bar.net" corresponds to Content-ID:- Specified by:
getContentIdin interfaceAttachment- Returns:
- The content ID like "foo-bar-zot@abc.com", without surrounding '<' and '>' used as the transfer syntax.
-
getContentType
public String getContentType()
Description copied from interface:AttachmentGets the MIME content-type of this attachment.- Specified by:
getContentTypein interfaceAttachment
-
asByteArray
public byte[] asByteArray()
Description copied from interface:AttachmentGets the attachment as an exact-length byte array.- Specified by:
asByteArrayin interfaceAttachment
-
asDataHandler
public jakarta.activation.DataHandler asDataHandler()
Description copied from interface:AttachmentGets the attachment as aDataHandler.- Specified by:
asDataHandlerin interfaceAttachment
-
asSource
public Source asSource()
Description copied from interface:AttachmentGets the attachment as aSource. Note that there's no guarantee that the attachment is actually an XML.- Specified by:
asSourcein interfaceAttachment
-
asInputStream
public InputStream asInputStream()
Description copied from interface:AttachmentObtains this attachment as anInputStream.- Specified by:
asInputStreamin interfaceAttachment
-
writeTo
public void writeTo(OutputStream os) throws IOException
Description copied from interface:AttachmentWrites the contents of the attachment into the given stream.- Specified by:
writeToin interfaceAttachment- Throws:
IOException
-
writeTo
public void writeTo(jakarta.xml.soap.SOAPMessage saaj) throws jakarta.xml.soap.SOAPExceptionDescription copied from interface:AttachmentWrites this attachment to the givenSOAPMessage.- Specified by:
writeToin interfaceAttachment- Throws:
jakarta.xml.soap.SOAPException
-
-