javax.mail.internet
Class PreencodedMimeBodyPart
java.lang.Object
javax.mail.BodyPart
javax.mail.internet.MimeBodyPart
javax.mail.internet.PreencodedMimeBodyPart
- All Implemented Interfaces:
- MimePart, Part
public class PreencodedMimeBodyPart
- extends MimeBodyPart
处理已编码数据的 MimeBodyPart。此类在构造消息并附加已编码(例如,使用 base64 编码)数据时很有用。数据可能已经通过应用程序进行编码,也可能已经以编码形式存储在文件或数据库中。在创建此对象时提供编码。数据通过使用
setText
、
setContent
或
setDataHandler
方法以常规方式连接到此对象。
英文文档:
A MimeBodyPart that handles data that has already been encoded.
This class is useful when constructing a message and attaching
data that has already been encoded (for example, using base64
encoding). The data may have been encoded by the application,
or may have been stored in a file or database in encoded form.
The encoding is supplied when this object is created. The data
is attached to this object in the usual fashion, by using the
setText
, setContent
, or
setDataHandler
methods.
- Since:
- JavaMail 1.4
Constructor Summary |
PreencodedMimeBodyPart(String encoding)
Create a PreencodedMimeBodyPart that assumes the data is
encoded using the specified encoding. |
Method Summary |
String |
getEncoding()
Returns the content transfer encoding specified when
this object was created. |
protected void |
updateHeaders()
Force the Content-Transfer-Encoding header to use
the encoding that was specified when this object was created. |
void |
writeTo(OutputStream os)
Output the body part as an RFC 822 format stream. |
Methods inherited from class javax.mail.internet.MimeBodyPart |
addHeader, addHeaderLine, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getFileName, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getSize, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setHeader, setText, setText, setText |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public
PreencodedMimeBodyPart(String encoding)
创建一个 PreencodedMimeBodyPart,它假定数据使用指定的编码进行编码。编码必须是支持 MIME 的 Content-Transfer-Encoding。
英文文档:
PreencodedMimeBodyPart
public PreencodedMimeBodyPart(String encoding)
- Create a PreencodedMimeBodyPart that assumes the data is
encoded using the specified encoding. The encoding must
be a MIME supported Content-Transfer-Encoding.
public String
getEncoding() throws MessagingException
返回创建此对象时所指定的内容传输编码。
英文文档:
getEncoding
public String getEncoding()
throws MessagingException
- Returns the content transfer encoding specified when
this object was created.
- Specified by:
getEncoding
in interface MimePart
- Overrides:
getEncoding
in class MimeBodyPart
- Returns:
- content-transfer-encoding
- Throws:
MessagingException
- See Also:
MimeBodyPart.headers
public void
writeTo(java.io.OutputStream os) throws java.io.IOException, MessagingException
以 RFC 822 格式流的形式输出正文部分。
英文文档:
writeTo
public void writeTo(OutputStream os)
throws IOException,
MessagingException
- Output the body part as an RFC 822 format stream.
- Specified by:
writeTo
in interface Part
- Overrides:
writeTo
in class MimeBodyPart
- Throws:
MessagingException
IOException
- if an error occurs writing to the
stream or if an error is generated
by the javax.activation layer.- See Also:
DataHandler.writeTo(java.io.OutputStream)
protected void
updateHeaders() throws MessagingException
强制 Content-Transfer-Encoding
头使用创建此对象时所指定的编码。
英文文档:
updateHeaders
protected void updateHeaders()
throws MessagingException
- Force the
Content-Transfer-Encoding
header to use
the encoding that was specified when this object was created.
- Overrides:
updateHeaders
in class MimeBodyPart
- Throws:
MessagingException
Submit a bug or feature Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
一看就知道只有菜鸟才干这么无知的事啦。
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!