public class MimePartDataSource extends java.lang.Object implements javax.activation.DataSource, MessageAware
MimePart
,
DataSource
Constructor and Description |
---|
MimePartDataSource(MimePart part)
Constructor, that constructs a DataSource from a MimePart.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentType()
Returns the content-type of this DataSource.
|
java.io.InputStream |
getInputStream()
Returns an input stream from this MimePart.
|
MessageContext |
getMessageContext()
Return the
MessageContext for the current part. |
java.lang.String |
getName()
DataSource method to return a name.
|
java.io.OutputStream |
getOutputStream()
DataSource method to return an output stream.
|
public MimePartDataSource(MimePart part)
part
- the MimePartpublic java.io.InputStream getInputStream() 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 the getContentStream()
method and decodes
it using the MimeUtility.decode()
method.
getInputStream
in interface javax.activation.DataSource
java.io.IOException
MimeMessage.getContentStream()
,
MimeBodyPart.getContentStream()
,
MimeUtility.decode(java.io.InputStream, java.lang.String)
public java.io.OutputStream getOutputStream() throws java.io.IOException
This implementation throws the UnknownServiceException.
getOutputStream
in interface javax.activation.DataSource
java.io.IOException
public java.lang.String getContentType()
This implementation just invokes the getContentType
method on the MimePart.
getContentType
in interface javax.activation.DataSource
public java.lang.String getName()
This implementation just returns an empty string.
getName
in interface javax.activation.DataSource
public MessageContext getMessageContext()
MessageContext
for the current part.getMessageContext
in interface MessageAware
Copyright © 2010 - 2020 Adobe. All Rights Reserved