Class MimePartDataSource
- java.lang.Object
-
- com.sun.xml.messaging.saaj.packaging.mime.internet.MimePartDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
public final class MimePartDataSource extends Object implements javax.activation.DataSource
A utility class that implements a DataSource out of a MimeBodyPart. This class is primarily meant for service providers.- Author:
- John Mani
-
-
Constructor Summary
Constructors Constructor Description MimePartDataSource(MimeBodyPart part)Constructor, that constructs a DataSource from a MimeBodyPart.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentType()Returns the content-type of this DataSource.InputStreamgetInputStream()Returns an input stream from this MimeBodyPart.StringgetName()DataSource method to return a name.OutputStreamgetOutputStream()DataSource method to return an output stream.
-
-
-
Constructor Detail
-
MimePartDataSource
public MimePartDataSource(MimeBodyPart part)
Constructor, that constructs a DataSource from a MimeBodyPart.- Parameters:
part- body part
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Returns an input stream from this MimeBodyPart.This method applies the appropriate transfer-decoding, based on the Content-Transfer-Encoding attribute of this MimeBodyPart. Thus the returned input stream is a decoded stream of bytes.
This implementation obtains the raw content from the MimeBodyPart using the
getContentStream()method and decodes it using theMimeUtility.decode()method.- Specified by:
getInputStreamin interfacejavax.activation.DataSource- Returns:
- decoded input stream
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream() throws IOException
DataSource method to return an output stream.This implementation throws the UnknownServiceException.
- Specified by:
getOutputStreamin interfacejavax.activation.DataSource- Throws:
IOException
-
getContentType
public String getContentType()
Returns the content-type of this DataSource.This implementation just invokes the
getContentTypemethod on the MimeBodyPart.- Specified by:
getContentTypein interfacejavax.activation.DataSource
-
getName
public String getName()
DataSource method to return a name.This implementation just returns an empty string.
- Specified by:
getNamein interfacejavax.activation.DataSource
-
-