MimePartDataSource (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.mail.internet Class MimePartDataSource

java.lang.Object
  extended by javax.mail.internet.MimePartDataSource
所有已实现的接口:
DataSource, MessageAware

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.

规范说明:
getInputStream in interface DataSource
返回:
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.

规范说明:
getOutputStream in interface DataSource
返回:
an OutputStream
抛出异常:
IOException

getContentType

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

This implementation just invokes the getContentType method on the MimePart.

规范说明:
getContentType in interface DataSource
返回:
the MIME Type

getName

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

This implementation just returns an empty string.

规范说明:
getName in interface DataSource
返回:
the name of the object.

getMessageContext

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

规范说明:
getMessageContext in interface MessageAware
从以下版本开始:
JavaMail 1.1

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.