📄 multipart.html
字号:
<HR><A NAME="parent"><!-- --></A><H3>parent</H3><PRE>protected <A HREF="../../javax/mail/Part.html" title="interface in javax.mail">Part</A> <B>parent</B></PRE><DL><DD>The <code>Part</code> containing this <code>Multipart</code>, if known.<P><DL><DT><B>Since:</B></DT> <DD>JavaMail 1.1</DD></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Multipart()"><!-- --></A><H3>Multipart</H3><PRE>protected <B>Multipart</B>()</PRE><DL><DD>Default constructor. An empty Multipart object is created.<P></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="setMultipartDataSource(javax.mail.MultipartDataSource)"><!-- --></A><H3>setMultipartDataSource</H3><PRE>protected void <B>setMultipartDataSource</B>(<A HREF="../../javax/mail/MultipartDataSource.html" title="interface in javax.mail">MultipartDataSource</A> mp) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Setup this Multipart object from the given MultipartDataSource. <p> The method adds the MultipartDataSource's BodyPart objects into this Multipart. This Multipart's contentType is set to that of the MultipartDataSource. <p> This method is typically used in those cases where one has a multipart data source that has already been pre-parsed into the individual body parts (for example, an IMAP datasource), but needs to create an appropriate Multipart subclass that represents a specific multipart subtype.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>mp</CODE> - Multipart datasource<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="getContentType()"><!-- --></A><H3>getContentType</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getContentType</B>()</PRE><DL><DD>Return the content-type of this Multipart. <p> This implementation just returns the value of the <code>contentType</code> field.<P><DD><DL><DT><B>Returns:</B><DD>content-type<DT><B>See Also:</B><DD><A HREF="../../javax/mail/Multipart.html#contentType"><CODE>contentType</CODE></A></DL></DD></DL><HR><A NAME="getCount()"><!-- --></A><H3>getCount</H3><PRE>public int <B>getCount</B>() throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Return the number of enclosed BodyPart objects. <p><P><DD><DL><DT><B>Returns:</B><DD>number of parts<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../javax/mail/Multipart.html#parts"><CODE>parts</CODE></A></DL></DD></DL><HR><A NAME="getBodyPart(int)"><!-- --></A><H3>getBodyPart</H3><PRE>public <A HREF="../../javax/mail/BodyPart.html" title="class in javax.mail">BodyPart</A> <B>getBodyPart</B>(int index) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Get the specified Part. Parts are numbered starting at 0.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the desired Part<DT><B>Returns:</B><DD>the Part<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if the given index is out of range.<DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="removeBodyPart(javax.mail.BodyPart)"><!-- --></A><H3>removeBodyPart</H3><PRE>public boolean <B>removeBodyPart</B>(<A HREF="../../javax/mail/BodyPart.html" title="class in javax.mail">BodyPart</A> part) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Remove the specified part from the multipart message. Shifts all the parts after the removed part down one.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>part</CODE> - The part to remove<DT><B>Returns:</B><DD>true if part removed, false otherwise<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE> - if no such Part exists<DD><CODE><A HREF="../../javax/mail/IllegalWriteException.html" title="class in javax.mail">IllegalWriteException</A></CODE> - if the underlying implementation does not support modification of existing values</DL></DD></DL><HR><A NAME="removeBodyPart(int)"><!-- --></A><H3>removeBodyPart</H3><PRE>public void <B>removeBodyPart</B>(int index) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Remove the part at specified location (starting from 0). Shifts all the parts after the removed part down one.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - Index of the part to remove<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if the given index is out of range.<DD><CODE><A HREF="../../javax/mail/IllegalWriteException.html" title="class in javax.mail">IllegalWriteException</A></CODE> - if the underlying implementation does not support modification of existing values</DL></DD></DL><HR><A NAME="addBodyPart(javax.mail.BodyPart)"><!-- --></A><H3>addBodyPart</H3><PRE>public void <B>addBodyPart</B>(<A HREF="../../javax/mail/BodyPart.html" title="class in javax.mail">BodyPart</A> part) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Adds a Part to the multipart. The BodyPart is appended to the list of existing Parts.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>part</CODE> - The Part to be appended<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE><DD><CODE><A HREF="../../javax/mail/IllegalWriteException.html" title="class in javax.mail">IllegalWriteException</A></CODE> - if the underlying implementation does not support modification of existing values</DL></DD></DL><HR><A NAME="addBodyPart(javax.mail.BodyPart, int)"><!-- --></A><H3>addBodyPart</H3><PRE>public void <B>addBodyPart</B>(<A HREF="../../javax/mail/BodyPart.html" title="class in javax.mail">BodyPart</A> part, int index) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Adds a BodyPart at position <code>index</code>. If <code>index</code> is not the last one in the list, the subsequent parts are shifted up. If <code>index</code> is larger than the number of parts present, the BodyPart is appended to the end.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>part</CODE> - The BodyPart to be inserted<DD><CODE>index</CODE> - Location where to insert the part<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE><DD><CODE><A HREF="../../javax/mail/IllegalWriteException.html" title="class in javax.mail">IllegalWriteException</A></CODE> - if the underlying implementation does not support modification of existing values</DL></DD></DL><HR><A NAME="writeTo(java.io.OutputStream)"><!-- --></A><H3>writeTo</H3><PRE>public abstract void <B>writeTo</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> os) throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A>, <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Output an appropriately encoded bytestream to the given OutputStream. The implementation subclass decides the appropriate encoding algorithm to be used. The bytestream is typically used for sending.<P><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE> - if an IO related exception occurs<DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="getParent()"><!-- --></A><H3>getParent</H3><PRE>public <A HREF="../../javax/mail/Part.html" title="interface in javax.mail">Part</A> <B>getParent</B>()</PRE><DL><DD>Return the <code>Part</code> that contains this <code>Multipart</code> object, or <code>null</code> if not known.<P><DD><DL><DT><B>Since:</B></DT> <DD>JavaMail 1.1</DD></DL></DD></DL><HR><A NAME="setParent(javax.mail.Part)"><!-- --></A><H3>setParent</H3><PRE>public void <B>setParent</B>(<A HREF="../../javax/mail/Part.html" title="interface in javax.mail">Part</A> parent)</PRE><DL><DD>Set the parent of this <code>Multipart</code> to be the specified <code>Part</code>. Normally called by the <code>Message</code> or <code>BodyPart</code> <code>setContent(Multipart)</code> method. <code>parent</code> may be <code>null</code> if the <code>Multipart</code> is being removed from its containing <code>Part</code>.<P><DD><DL><DT><B>Since:</B></DT> <DD>JavaMail 1.1</DD></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Ent. Ed. v1.4</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/mail/MessageContext.html" title="class in javax.mail"><B>PREV CLASS</B></A> <A HREF="../../javax/mail/PasswordAuthentication.html" title="class in javax.mail"><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> <A HREF="Multipart.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -