mimebodypart.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 1,360 行 · 第 1/5 页

HTML
1,360
字号
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>an InputStream<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DD><CODE>java.io.IOException</CODE> - this is typically thrown by the
			DataHandler. Refer to the documentation for
			javax.activation.DataHandler for more details.<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeBodyPart.html#getContentStream()"><CODE>getContentStream()</CODE></A>, 
<A HREF="../../../javax/activation/DataHandler.html#getInputStream()"><CODE>DataHandler.getInputStream()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getContentStream()"><!-- --></A><H3>
getContentStream</H3>
<PRE>
protected java.io.InputStream <B>getContentStream</B>()
                                        throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Produce the raw bytes of the content. This method is used
 when creating a DataHandler object for the content. Subclasses
 that can provide a separate input stream for just the Part
 content might want to override this method. <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeBodyPart.html#content"><CODE>content</CODE></A>, 
<A HREF="../../../javax/mail/internet/MimeMessage.html#getContentStream()"><CODE>MimeMessage.getContentStream()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getRawInputStream()"><!-- --></A><H3>
getRawInputStream</H3>
<PRE>
public java.io.InputStream <B>getRawInputStream</B>()
                                      throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return an InputStream to the raw data with any Content-Transfer-Encoding
 intact.  This method is useful if the "Content-Transfer-Encoding"
 header is incorrect or corrupt, which would prevent the
 <code>getInputStream</code> method or <code>getContent</code> method
 from returning the correct data.  In such a case the application may
 use this method and attempt to decode the raw data itself. <p>

 This implementation simply calls the <code>getContentStream</code>
 method.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Since: </B><DD>JavaMail 1.2</DD>
<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeBodyPart.html#getInputStream()"><CODE>getInputStream()</CODE></A>, 
<A HREF="../../../javax/mail/internet/MimeBodyPart.html#getContentStream()"><CODE>getContentStream()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getDataHandler()"><!-- --></A><H3>
getDataHandler</H3>
<PRE>
public <A HREF="../../../javax/activation/DataHandler.html">DataHandler</A> <B>getDataHandler</B>()
                           throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return a DataHandler for this body part's content. <p>

 The implementation provided here works just like the
 the implementation in MimeMessage.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#getDataHandler()">getDataHandler</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeMessage.html#getDataHandler()"><CODE>MimeMessage.getDataHandler()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getContent()"><!-- --></A><H3>
getContent</H3>
<PRE>
public java.lang.Object <B>getContent</B>()
                            throws java.io.IOException,
                                   <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return the content as a java object. The type of the object
 returned is of course dependent on the content itself. For 
 example, the native format of a text/plain content is usually
 a String object. The native format for a "multipart"
 content is always a Multipart subclass. For content types that are
 unknown to the DataHandler system, an input stream is returned
 as the content. <p>

 This implementation obtains the content from the DataHandler.
 That is, it invokes getDataHandler().getContent();<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#getContent()">getContent</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>Object<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DD><CODE>java.io.IOException</CODE> - this is typically thrown by the
			DataHandler. Refer to the documentation for
			javax.activation.DataHandler for more details.</DL>
</DD>
</DL>
<HR>

<A NAME="setDataHandler(javax.activation.DataHandler)"><!-- --></A><H3>
setDataHandler</H3>
<PRE>
public void <B>setDataHandler</B>(<A HREF="../../../javax/activation/DataHandler.html">DataHandler</A>&nbsp;dh)
                    throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>This method provides the mechanism to set this body part's content.
 The given DataHandler object should wrap the actual content.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#setDataHandler(javax.activation.DataHandler)">setDataHandler</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dh</CODE> - The DataHandler for the content<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/IllegalWriteException.html">IllegalWriteException</A></CODE> - if the underlying
 			implementation does not support modification<DD><CODE>java.lang.IllegalStateException</CODE> - if this body part is
			obtained from a READ_ONLY folder.</DL>
</DD>
</DL>
<HR>

<A NAME="setContent(java.lang.Object, java.lang.String)"><!-- --></A><H3>
setContent</H3>
<PRE>
public void <B>setContent</B>(java.lang.Object&nbsp;o,
                       java.lang.String&nbsp;type)
                throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>A convenience method for setting this body part's content. <p>

 The content is wrapped in a DataHandler object. Note that a
 DataContentHandler class for the specified type should be
 available to the JavaMail implementation for this to work right.
 That is, to do <code>setContent(foobar, "application/x-foobar")</code>,
 a DataContentHandler for "application/x-foobar" should be installed.
 Refer to the Java Activation Framework for more information.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#setContent(java.lang.Object, java.lang.String)">setContent</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - the content object<DD><CODE>type</CODE> - Mime type of the object<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/IllegalWriteException.html">IllegalWriteException</A></CODE> - if the underlying
			implementation does not support modification of
			existing values<DD><CODE>java.lang.IllegalStateException</CODE> - if this body part is
			obtained from a READ_ONLY folder.</DL>
</DD>
</DL>
<HR>

<A NAME="setText(java.lang.String)"><!-- --></A><H3>
setText</H3>
<PRE>
public void <B>setText</B>(java.lang.String&nbsp;text)
             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Convenience method that sets the given String as this
 part's content, with a MIME type of "text/plain". If the
 string contains non US-ASCII characters, it will be encoded
 using the platform's default charset. The charset is also
 used to set the "charset" parameter. <p>

 Note that there may be a performance penalty if
 <code>text</code> is large, since this method may have
 to scan all the characters to determine what charset to
 use. <p>
 If the charset is already known, use the
 setText() version that takes the charset parameter.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/internet/MimePart.html#setText(java.lang.String)">setText</A></CODE> in interface <CODE><A HREF="../../../javax/mail/internet/MimePart.html">MimePart</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeBodyPart.html#setText(java.lang.String, java.lang.String)"><CODE>setText(String text, String charset)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setText(java.lang.String, java.lang.String)"><!-- --></A><H3>
setText</H3>
<PRE>
public void <B>setText</B>(java.lang.String&nbsp;text,
                    java.lang.String&nbsp;charset)
             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Convenience method that sets the given String as this part's
 content, with a MIME type of "text/plain" and the specified
 charset. The given Unicode string will be charset-encoded
 using the specified charset. The charset is also used to set
 the "charset" parameter.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/internet/MimePart.html#setText(java.lang.String, java.lang.String)">setText</A></CODE> in interface <CODE><A HREF="../../../javax/mail/internet/MimePart.html">MimePart</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="setContent(javax.mail.Multipart)"><!-- --></A><H3>
setContent</H3>
<PRE>
public void <B>setContent</B>(<A HREF="../../../javax/mail/Multipart.html">Multipart</A>&nbsp;mp)
                throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>This method sets the body part's content to a Multipart object.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#setContent(javax.mail.Multipart)">setContent</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>mp</CODE> - The multipart object that is the Message's content<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/IllegalWriteException.html">IllegalWriteException</A></CODE> - if the underlying
			implementation does not support modification of
			existing values.<DD><CODE>java.lang.IllegalStateException</CODE> - if this body part is
			obtained from a READ_ONLY folder.</DL>
</DD>
</DL>
<HR>

<A NAME="writeTo(java.io.OutputStream)"><!-- --></A><H3>
writeTo</H3>
<PRE>
public void <B>writeTo</B>(java.io.OutputStream&nbsp;os)
             throws java.io.IOException,
                    <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Output the body part as an RFC 822 format stream.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#writeTo(java.io.OutputStream)">writeTo</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DD><CODE>java.io.IOException</CODE> - if an error occurs writing to the
				stream or if an error is generated
				by the javax.activation layer.<DT><B>See Also: </B><DD><A HREF="../../../javax/activation/DataHandler.html#writeTo(java.io.OutputStream)"><CODE>DataHandler.writeTo(java.io.OutputStream)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getHeader(java.lang.String)"><!-- --></A><H3>
getHeader</H3>
<PRE>
public java.lang.String[] <B>getHeader</B>(java.lang.String&nbsp;name)
                             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Get all the headers for this header_name. Note that certain
 headers may be encoded as per RFC 2047 if they contain
 non US-ASCII characters and these should be decoded.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/Part.html#getHeader(java.lang.String)">getHeader</A></CODE> in interface <CODE><A HREF="../../../javax/mail/Part.html">Part</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - name of header<DT><B>Returns:</B><DD>array of headers<DT><B>See Also: </B><DD><A HREF="../../../javax/mail/internet/MimeUtility.html"><CODE>MimeUtility</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getHeader(java.lang.String, java.lang.String)"><!-- --></A><H3>
getHeader</H3>
<PRE>
public java.lang.String <B>getHeader</B>(java.lang.String&nbsp;name,
                                  java.lang.String&nbsp;delimiter)
                           throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Get all the headers for this header name, returned as a single
 String, with headers separated by the delimiter. If the
 delimiter is <code>null</code>, only the first header is 
 returned.<DD><DL>
<DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/mail/internet/MimePart.html#getHeader(java.lang.String, java.lang.String)">getHeader</A></CODE> in interface <CODE><A HREF="../../../javax/mail/internet/MimePart.html">MimePart</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>header_name</CODE> - the name of this header<DT><B>Returns:</B><DD>the value fields for all headers with 
				this name<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="setHeader(java.lang.String, java.lang.String)"><!-- --></A><H3>
setHeader</H3>
<PRE>
public void <B>setHeader</B>(java.lang.String&nbsp;name,
                      java.lang.String&nbsp;value)
               throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Set the value for this header_name. Replaces all existing
 header values with this new value. Note that RFC 822 headers
 must contain only US-ASCII characters, so a header that
 contains non US-ASCII characters must be encoded as per the
 rules of RFC 2047.<DD><DL>
<DT

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?