part.html

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

HTML
887
字号
<PRE>
public java.io.InputStream <B>getInputStream</B>()
                                   throws java.io.IOException,
                                          <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return an input stream for this part's "content". Any 
 mail-specific transfer encodings will be decoded before the 
 input stream is provided. <p>

 This is typically a convenience method that just invokes
 the DataHandler's <code>getInputStream()</code> method.<DD><DL>
<DT><B>Returns:</B><DD>an InputStream<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - this is typically thrown by the 
			DataHandler. Refer to the documentation for 
			javax.activation.DataHandler for more details.<DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>See Also: </B><DD><A HREF="../../javax/mail/Part.html#getDataHandler()"><CODE>getDataHandler()</CODE></A>, 
<A HREF="../../javax/activation/DataHandler.html#getInputStream()"><CODE>DataHandler.getInputStream()</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 the content within this part. The
 DataHandler allows clients to operate on as well as retrieve
 the content.<DD><DL>
<DT><B>Returns:</B><DD>DataHandler for the content<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</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 returned 
 object is of course dependent on the content itself. For example,
 the object returned for "text/plain" content is usually a String 
 object. The object returned 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 is a convenience method that just invokes the DataHandler's
 getContent() method<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.<DT><B>See Also: </B><DD><A HREF="../../javax/activation/DataHandler.html#getContent()"><CODE>DataHandler.getContent()</CODE></A></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 part's content.
 The DataHandler wraps around the actual content.<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/MessagingException.html">MessagingException</A></CODE> - &nbsp;<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 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;obj,
                       java.lang.String&nbsp;type)
                throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>A convenience method for setting this part's content.  The part
 internally wraps the content in a DataHandler. <p>

 Note that a DataContentHandler class for the specified type should 
 be available to the JavaMail implementation for this to work right.
 i.e., 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>Parameters:</B><DD><CODE>obj</CODE> - A java object.<DD><CODE>type</CODE> - MIME type of this 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 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>A convenience method that sets the given String as this
 part's content with a MIME type of "text/plain".<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - The text 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 Part is obtained
			from a READ_ONLY folder</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 given Multipart object as this message's
 content.<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 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 a bytestream for this Part. This bytestream is
 typically an aggregration of the Part attributes and
 an appropriately encoded bytestream from its 'content'. <p>

 Classes that implement the Part interface decide on
 the appropriate encoding algorithm to be used. <p>

 The bytestream is typically used for sending.<DD><DL>
<DT><B>Throws:</B><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.<DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - if an error occurs fetching the
					data to be written<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;header_name)
                             throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Get all the headers for this header name. Returns <code>null</code>
 if no headers for this header name are available.<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;header_name,
                      java.lang.String&nbsp;header_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.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>header_name</CODE> - the name of this header<DD><CODE>header_value</CODE> - the value for this header<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<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 Part is 
				obtained from a READ_ONLY folder</DL>
</DD>
</DL>
<HR>

<A NAME="addHeader(java.lang.String, java.lang.String)"><!-- --></A><H3>
addHeader</H3>
<PRE>
public void <B>addHeader</B>(java.lang.String&nbsp;header_name,
                      java.lang.String&nbsp;header_value)
               throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Add this value to the existing values for this header_name.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>header_name</CODE> - the name of this header<DD><CODE>header_value</CODE> - the value for this header<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<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 Part is 
				obtained from a READ_ONLY folder</DL>
</DD>
</DL>
<HR>

<A NAME="removeHeader(java.lang.String)"><!-- --></A><H3>
removeHeader</H3>
<PRE>
public void <B>removeHeader</B>(java.lang.String&nbsp;header_name)
                  throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Remove all headers with this name.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>header_name</CODE> - the name of this header<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<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 Part is 
				obtained from a READ_ONLY folder</DL>
</DD>
</DL>
<HR>

<A NAME="getAllHeaders()"><!-- --></A><H3>
getAllHeaders</H3>
<PRE>
public java.util.Enumeration <B>getAllHeaders</B>()
                                    throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return all the headers from this part as an Enumeration of
 Header objects.<DD><DL>
<DT><B>Returns:</B><DD>array of Header objects<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="getMatchingHeaders(java.lang.String[])"><!-- --></A><H3>
getMatchingHeaders</H3>
<PRE>
public java.util.Enumeration <B>getMatchingHeaders</B>(java.lang.String[]&nbsp;header_names)
                                         throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return matching headers from this part as an Enumeration of
 Header objects.<DD><DL>
<DT><B>Returns:</B><DD>array of Header objects<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="getNonMatchingHeaders(java.lang.String[])"><!-- --></A><H3>
getNonMatchingHeaders</H3>
<PRE>
public java.util.Enumeration <B>getNonMatchingHeaders</B>(java.lang.String[]&nbsp;header_names)
                                            throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return non-matching headers from this envelope as an Enumeration
 of Header objects.<DD><DL>
<DT><B>Returns:</B><DD>array of Header objects<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../javax/mail/MultipartDataSource.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../javax/mail/UIDFolder.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Part.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>

⌨️ 快捷键说明

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