PreencodedMimeBodyPart (Java EE 5)

Java EE API


javax.mail.internet Class PreencodedMimeBodyPart

java.lang.Object
  extended by javax.mail.BodyPart
      extended by javax.mail.internet.MimeBodyPart
          extended by javax.mail.internet.PreencodedMimeBodyPart
All Implemented Interfaces:
MimePart, Part

public class PreencodedMimeBodyPart
extends MimeBodyPart


处理已编码数据的 MimeBodyPart。此类在构造消息并附加已编码(例如,使用 base64 编码)数据时很有用。数据可能已经通过应用程序进行编码,也可能已经以编码形式存储在文件或数据库中。在创建此对象时提供编码。数据通过使用 setTextsetContentsetDataHandler 方法以常规方式连接到此对象。
英文文档:

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

Field Summary
 
Fields inherited from class javax.mail.internet.MimeBodyPart
 
Fields inherited from class javax.mail.BodyPart
 
Fields inherited from interface javax.mail.Part
 
Constructor Summary
 
Method Summary
 String
protected  void
 void
 
Methods inherited from class javax.mail.internet.MimeBodyPart
 
Methods inherited from class javax.mail.BodyPart
 
Methods inherited from class java.lang.Object
 

Constructor Detail

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.

Method Detail

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 格式流的形式输出正文部分。
ThrowsMessagingException:
Throwsjava.io.IOException: 如果写入流时发生错误,或者 javax.activation 层发生错误。
See also writeTo
英文文档:

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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!