java.lang.Object | +--javax.mail.internet.MimePartDataSource
A utility class that implements a DataSource out of a MimePart. This class is primarily meant for service providers.
MimePart
,DataSource
MimePartDataSource(MimePart part) Constructor, that constructs a DataSource from a MimePart. |
getContentType() Returns the content-type of this DataSource. | |
getInputStream() Returns an input stream from this MimePart. | |
getMessageContext() Return the MessageContext for the current part. | |
getName() DataSource method to return a name. | |
getOutputStream() DataSource method to return an output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
publicMimePartDataSource(MimePart part)
public java.io.InputStreamgetInputStream() throws java.io.IOException
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 thegetContentStream()
method and decodes it using theMimeUtility.decode()
method.
getInputStream
in interfaceDataSource
MimeMessage.getContentStream()
,MimeBodyPart.getContentStream()
,MimeUtility.decode(java.io.InputStream, java.lang.String)
public java.io.OutputStreamgetOutputStream() throws java.io.IOException
This implementation throws the UnknownServiceException.
getOutputStream
in interfaceDataSource
javax.activation.DataSource
public java.lang.StringgetContentType()
This implementation just invokes thegetContentType
method on the MimePart.
getContentType
in interfaceDataSource
javax.activation.DataSource
public java.lang.StringgetName()
This implementation just returns an empty string.
getName
in interfaceDataSource
javax.activation.DataSource
publicMessageContextgetMessageContext()
MessageContext
for the current part.getMessageContext
in interfaceMessageAware