|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.mail.internet Class MimePartDataSource
java.lang.Object javax.mail.internet.MimePartDataSource
- All Implemented Interfaces:
- DataSource, MessageAware
public class MimePartDataSource
- extends Object
- implements DataSource, MessageAware
实现 MimePart 中的 DataSource 的实用工具类。此类主要供服务提供者使用。
See also | javax.mail.internet.MimePart, javax.activation.DataSource |
A utility class that implements a DataSource out of a MimePart. This class is primarily meant for service providers.
- Author:
- John Mani
- See Also:
MimePart
,DataSource
Field Summary | |
---|---|
protected MimePart |
part
The MimePart that provides the data for this DataSource. |
Constructor Summary | |
---|---|
MimePartDataSource(MimePart part)
Constructor, that constructs a DataSource from a MimePart. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
英文文档:
part
protected MimePart part
- The MimePart that provides the data for this DataSource.
- Since:
- JavaMail 1.4
Constructor Detail |
---|
public
MimePartDataSource(MimePart part)
构造方法,根据 MimePart 构造 DataSource。
英文文档:
MimePartDataSource
public MimePartDataSource(MimePart part)
- Constructor, that constructs a DataSource from a MimePart.
Method Detail |
---|
public java.io.InputStream
getInputStream() throws java.io.IOException
返回此 MimePart 的输入流。
此方法根据此 MimePart 的 Content-Transfer-Encoding 属性的不同应用相应的传输编码。因此,返回的输入流是已解码的字节流。
此实现使用 getContentStream()
方法从 Part 中获取原始内容,并使用 MimeUtility.decode()
方法对它进行解码。
return | 已解码的输入流 |
See also | getContentStream, getContentStream, decode |
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 theMimeUtility.decode()
method. - Specified by:
getInputStream
in interfaceDataSource
- Returns:
- decoded input stream
- Throws:
IOException
- See Also:
MimeMessage.getContentStream()
,MimeBodyPart.getContentStream()
,MimeUtility.decode(java.io.InputStream, java.lang.String)
public java.io.OutputStream
getOutputStream() throws java.io.IOException
返回输出流的 DataSource 方法。
此实现抛出 UnknownServiceException。
getOutputStream
public OutputStream getOutputStream() throws IOException
- DataSource method to return an output stream.
This implementation throws the UnknownServiceException.
- Specified by:
getOutputStream
in interfaceDataSource
- Returns:
- an OutputStream
- Throws:
IOException
public String
getContentType()
返回此 DataSource 的内容类型。
此实现仅对 MimePart 调用 getContentType
方法。
getContentType
public String getContentType()
- Returns the content-type of this DataSource.
This implementation just invokes the
getContentType
method on the MimePart. - Specified by:
getContentType
in interfaceDataSource
- Returns:
- the MIME Type
public String
getName()
返回名称的 DataSource 方法。
此实现仅返回一个空字符串。
getName
public String getName()
- DataSource method to return a name.
This implementation just returns an empty string.
- Specified by:
getName
in interfaceDataSource
- Returns:
- the name of the object.
public MessageContext
getMessageContext()
返回当前部分的 MessageContext
。
since |
|
getMessageContext
public MessageContext getMessageContext()
- Return the
MessageContext
for the current part. - Specified by:
getMessageContext
in interfaceMessageAware
- Since:
- JavaMail 1.1
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!