javax.mail.internet
类 MimePartDataSource

java.lang.Object
  继承者 javax.mail.internet.MimePartDataSource
所有已实现的接口:
DataSource, MessageAware
直接已知子类:
IMAPMultipartDataSource

public class MimePartDataSource
extends Object
implements DataSource, MessageAware

A utility class that implements a DataSource out of a MimePart. This class is primarily meant for service providers.

作者:
John Mani
另请参见:
MimePart, DataSource

字段摘要
protected  MimePart part
          The MimePart that provides the data for this DataSource.
 
构造方法摘要
MimePartDataSource(MimePart part)
          Constructor, that constructs a DataSource from a MimePart.
 
方法摘要
 String getContentType()
          Returns the content-type of this DataSource.
 InputStream getInputStream()
          Returns an input stream from this MimePart.
 MessageContext getMessageContext()
          Return the MessageContext for the current part.
 String getName()
          DataSource method to return a name.
 OutputStream getOutputStream()
          DataSource method to return an output stream.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

part

protected MimePart part
The MimePart that provides the data for this DataSource.

从以下版本开始:
JavaMail 1.4
构造方法详细信息

MimePartDataSource

public MimePartDataSource(MimePart part)
Constructor, that constructs a DataSource from a 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.

指定者:
接口 DataSource 中的 getInputStream
返回:
decoded input stream
抛出:
IOException
另请参见:
MimeMessage.getContentStream(), MimeBodyPart.getContentStream(), MimeUtility.decode(java.io.InputStream, java.lang.String)

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
DataSource method to return an output stream.

This implementation throws the UnknownServiceException.

指定者:
接口 DataSource 中的 getOutputStream
抛出:
IOException

getContentType

public String getContentType()
Returns the content-type of this DataSource.

This implementation just invokes the getContentType method on the MimePart.

指定者:
接口 DataSource 中的 getContentType

getName

public String getName()
DataSource method to return a name.

This implementation just returns an empty string.

指定者:
接口 DataSource 中的 getName

getMessageContext

public MessageContext getMessageContext()
Return the MessageContext for the current part.

指定者:
接口 MessageAware 中的 getMessageContext
从以下版本开始:
JavaMail 1.1


Copyright © 2013. All Rights Reserved.