javax.mail.internet
Class MimePartDataSource
java.lang.Object
javax.mail.internet.MimePartDataSource
- DataSource, MessageAware
public class MimePartDataSource
extends java.lang.Object
A utility class that implements a DataSource out of a MimePart.
This class is primarily meant for service providers.
MimePartDataSource
public MimePartDataSource(MimePart part)
Constructor, that constructs a DataSource from a MimePart.
getContentType
public String getContentType()
Returns the content-type of this DataSource.
This implementation just invokes the getContentType method on the
MimePart.
getInputStream
public InputStream getInputStream()
throws IOException
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 the
MimeUtility.decode()
method.
- decoded input stream
getName
public String getName()
DataSource method to return a name.
This implementation just returns an empty string.
getOutputStream
public OutputStream getOutputStream()
throws IOException
DataSource method to return an output stream.
This implementation throws the UnknownServiceException.