mimemultipart.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 956 行 · 第 1/4 页

HTML
956
字号
 This constructor handles as a special case the situation where the given DataSource is a MultipartDataSource object.  In this case, this method just invokes the superclass (i.e., Multipart) constructor that takes a MultipartDataSource object. <p> Otherwise, the DataSource is assumed to provide a MIME multipart  byte stream.  The <code>parsed</code> flag is set to false.  When the data for the body parts are needed, the parser extracts the "boundary" parameter from the content type of this DataSource, skips the 'preamble' and reads bytes till the terminating boundary and creates MimeBodyParts for each part of the stream.<P><DL><DT><B>Parameters:</B><DD><CODE>ds</CODE> - DataSource, can be a MultipartDataSource<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="setSubType(java.lang.String)"><!-- --></A><H3>setSubType</H3><PRE>public void <B>setSubType</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;subtype)                throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Set the subtype. This method should be invoked only on a new MimeMultipart object created by the client. The default subtype of such a multipart object is "mixed". <p><P><DD><DL><DT><B>Parameters:</B><DD><CODE>subtype</CODE> - Subtype<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="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><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#getCount()">getCount</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html" title="class in javax.mail">Multipart</A></CODE></DL></DD><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>Multipart.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&nbsp;index)                     throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Get the specified BodyPart.  BodyParts are numbered starting at 0.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#getBodyPart(int)">getBodyPart</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html" title="class in javax.mail">Multipart</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the desired BodyPart<DT><B>Returns:</B><DD>the Part<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE> - if no such BodyPart exists</DL></DD></DL><HR><A NAME="getBodyPart(java.lang.String)"><!-- --></A><H3>getBodyPart</H3><PRE>public <A HREF="../../../javax/mail/BodyPart.html" title="class in javax.mail">BodyPart</A> <B>getBodyPart</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;CID)                     throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Get the MimeBodyPart referred to by the given ContentID (CID).  Returns null if the part is not found.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>CID</CODE> - the ContentID of the desired part<DT><B>Returns:</B><DD>the Part<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="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>&nbsp;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>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#removeBodyPart(javax.mail.BodyPart)">removeBodyPart</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html" title="class in javax.mail">Multipart</A></CODE></DL></DD><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&nbsp;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>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#removeBodyPart(int)">removeBodyPart</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html" title="class in javax.mail">Multipart</A></CODE></DL></DD><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.5/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>&nbsp;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>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#addBodyPart(javax.mail.BodyPart)">addBodyPart</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html" title="class in javax.mail">Multipart</A></CODE></DL></DD><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>&nbsp;part,                        int&nbsp;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>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#addBodyPart(javax.mail.BodyPart, int)">addBodyPart</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html" title="class in javax.mail">Multipart</A></CODE></DL></DD><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="isComplete()"><!-- --></A><H3>isComplete</H3><PRE>public boolean <B>isComplete</B>()                   throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Return true if the final boundary line for this multipart was seen.  When parsing multipart content, this class will (by default) terminate parsing with no error if the end of input is reached before seeing the final multipart boundary line.  In such a case, this method will return false.  (If the System property "mail.mime.multipart.ignoremissingendboundary" is set to false, parsing such a message will instead throw a MessagingException.)<P><DD><DL><DT><B>Returns:</B><DD>true if the final boundary line was seen<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE><DT><B>Since:</B></DT>  <DD>JavaMail 1.4</DD></DL></DD></DL><HR><A NAME="getPreamble()"><!-- --></A><H3>getPreamble</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getPreamble</B>()                   throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Get the preamble text, if any, that appears before the first body part of this multipart.  Some protocols,

⌨️ 快捷键说明

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