Package javax.mail.internet
Class MimePartDataSource
java.lang.Object
javax.mail.internet.MimePartDataSource
- All Implemented Interfaces:
javax.activation.DataSource
,MessageAware
A utility class that implements a DataSource out of
a MimePart. This class is primarily meant for service providers.
- See Also:
-
MimePart
DataSource
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMimePartDataSource
(MimePart part) Constructor, that constructs a DataSource from a MimePart. -
Method Summary
Modifier and TypeMethodDescriptionReturns the content-type of this DataSource.Returns an input stream from this MimePart.Return theMessageContext
for the current part.getName()
DataSource method to return a name.DataSource method to return an output stream.
-
Field Details
-
part
The MimePart that provides the data for this DataSource.- Since:
- JavaMail 1.4
-
-
Constructor Details
-
MimePartDataSource
Constructor, that constructs a DataSource from a MimePart.
-
-
Method Details
-
getInputStream
Returns an input stream from this MimePart.This method applies the appropriate transfer-decoding, based on the Content-Transfer-Encoding attribute of this MimePart. Thus the returned input stream is a decoded stream of bytes.
This implementation obtains the raw content from the Part using the
getContentStream()
method and decodes it using theMimeUtility.decode()
method.- Specified by:
getInputStream
in interfacejavax.activation.DataSource
- Returns:
- decoded input stream
- Throws:
IOException
- See Also:
-
getOutputStream
DataSource method to return an output stream.This implementation throws the UnknownServiceException.
- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- Throws:
IOException
-
getContentType
Returns the content-type of this DataSource.This implementation just invokes the
getContentType
method on the MimePart.- Specified by:
getContentType
in interfacejavax.activation.DataSource
-
getName
DataSource method to return a name.This implementation just returns an empty string.
- Specified by:
getName
in interfacejavax.activation.DataSource
-
getMessageContext
Return theMessageContext
for the current part.- Specified by:
getMessageContext
in interfaceMessageAware
- Since:
- JavaMail 1.1
-