mimemultipart.html

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

HTML
598
字号
protected <A HREF="../../../javax/activation/DataSource.html">DataSource</A> <B>ds</B></PRE>
<DL>
<DD>The DataSource supplying our InputStream.</DL>
<HR>

<A NAME="parsed"><!-- --></A><H3>
parsed</H3>
<PRE>
protected boolean <B>parsed</B></PRE>
<DL>
<DD>Have we parsed the data from our InputStream yet?
 Defaults to true; set to false when our constructor is
 given a DataSource with an InputStream that we need to
 parse.</DL>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="MimeMultipart()"><!-- --></A><H3>
MimeMultipart</H3>
<PRE>
public <B>MimeMultipart</B>()</PRE>
<DL>
<DD>Default constructor. An empty MimeMultipart object
 is created. Its content type is set to "multipart/mixed".
 A unique boundary string is generated and this string is
 setup as the "boundary" parameter for the 
 <code>contentType</code> field. <p>

 MimeBodyParts may be added later.</DL>
<HR>

<A NAME="MimeMultipart(java.lang.String)"><!-- --></A><H3>
MimeMultipart</H3>
<PRE>
public <B>MimeMultipart</B>(java.lang.String&nbsp;subtype)</PRE>
<DL>
<DD>Construct a MimeMultipart object of the given subtype.
 A unique boundary string is generated and this string is
 setup as the "boundary" parameter for the 
 <code>contentType</code> field. <p>

 MimeBodyParts may be added later.</DL>
<HR>

<A NAME="MimeMultipart(javax.activation.DataSource)"><!-- --></A><H3>
MimeMultipart</H3>
<PRE>
public <B>MimeMultipart</B>(<A HREF="../../../javax/activation/DataSource.html">DataSource</A>&nbsp;ds)
              throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Constructs a MimeMultipart object and its bodyparts from the 
 given DataSource. <p>

 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.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ds</CODE> - DataSource, can be a MultipartDataSource</DL>
</DD>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="setSubType(java.lang.String)"><!-- --></A><H3>
setSubType</H3>
<PRE>
public void <B>setSubType</B>(java.lang.String&nbsp;subtype)
                throws <A HREF="../../../javax/mail/MessagingException.html">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><DD><DL>
<DT><B>Parameters:</B><DD><CODE>subtype</CODE> - Subtype</DL>
</DD>
</DL>
<HR>

<A NAME="getCount()"><!-- --></A><H3>
getCount</H3>
<PRE>
public int <B>getCount</B>()
             throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Return the number of enclosed BodyPart objects.<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">Multipart</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>number of parts</DL>
</DD>
</DL>
<HR>

<A NAME="getBodyPart(int)"><!-- --></A><H3>
getBodyPart</H3>
<PRE>
public <A HREF="../../../javax/mail/BodyPart.html">BodyPart</A> <B>getBodyPart</B>(int&nbsp;index)
                     throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Get the specified BodyPart.  BodyParts are numbered starting at 0.<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">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">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">BodyPart</A> <B>getBodyPart</B>(java.lang.String&nbsp;CID)
                     throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Get the MimeBodyPart referred to by the given ContentID (CID). 
 Returns null if the part is not found.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>CID</CODE> - the ContentID of the desired part<DT><B>Returns:</B><DD>the Part</DL>
</DD>
</DL>
<HR>

<A NAME="updateHeaders()"><!-- --></A><H3>
updateHeaders</H3>
<PRE>
protected void <B>updateHeaders</B>()
                      throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Update headers. The default implementation here just
 calls the <code>updateHeaders</code> method on each of its
 children BodyParts. <p>

 Note that the boundary parameter is already set up when
 a new and empty MimeMultipart object is created. <p>

 This method is called when the <code>saveChanges</code>
 method is invoked on the Message object containing this
 Multipart. This is typically done as part of the Message
 send process, however note that a client is free to call
 it any number of times. So if the header updating process is 
 expensive for a specific MimeMultipart subclass, then it
 might itself want to track whether its internal state actually
 did change, and do the header updating only if necessary.</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>Iterates through all the parts and outputs each Mime part
 separated by a boundary.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/mail/Multipart.html#writeTo(java.io.OutputStream)">writeTo</A></CODE> in class <CODE><A HREF="../../../javax/mail/Multipart.html">Multipart</A></CODE></DL>
</DD>
<DD>Following copied from class: <CODE>javax.mail.Multipart</CODE></DD>
<DD><DL>
<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an IO related exception occurs<DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>

<A NAME="parse()"><!-- --></A><H3>
parse</H3>
<PRE>
protected void <B>parse</B>()
              throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Parse the InputStream from our DataSource, constructing the
 appropriate MimeBodyParts.  The <code>parsed</code> flag is
 set to true, and if true on entry nothing is done.  This
 method is called by all other methods that need data for
 the body parts, to make sure the data has been parsed.<DD><DL>
<DT><B>Since: </B><DD>JavaMail 1.2</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="createInternetHeaders(java.io.InputStream)"><!-- --></A><H3>
createInternetHeaders</H3>
<PRE>
protected <A HREF="../../../javax/mail/internet/InternetHeaders.html">InternetHeaders</A> <B>createInternetHeaders</B>(java.io.InputStream&nbsp;is)
                                         throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Create and return an InternetHeaders object that loads the
 headers from the given InputStream.  Subclasses can override
 this method to return a subclass of InternetHeaders, if
 necessary.  This implementation simply constructs and returns
 an InternetHeaders object.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>is</CODE> - the InputStream to read the headers from<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>Since: </B><DD>JavaMail 1.2</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="createMimeBodyPart(javax.mail.internet.InternetHeaders, byte[])"><!-- --></A><H3>
createMimeBodyPart</H3>
<PRE>
protected <A HREF="../../../javax/mail/internet/MimeBodyPart.html">MimeBodyPart</A> <B>createMimeBodyPart</B>(<A HREF="../../../javax/mail/internet/InternetHeaders.html">InternetHeaders</A>&nbsp;headers,
                                          byte[]&nbsp;content)
                                   throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Create and return a MimeBodyPart object to represent a
 body part parsed from the InputStream.  Subclasses can override
 this method to return a subclass of MimeBodyPart, if
 necessary.  This implementation simply constructs and returns
 a MimeBodyPart object.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>headers</CODE> - the headers for the body part<DD><CODE>content</CODE> - the content of the body part<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>Since: </B><DD>JavaMail 1.2</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="createMimeBodyPart(java.io.InputStream)"><!-- --></A><H3>
createMimeBodyPart</H3>
<PRE>
protected <A HREF="../../../javax/mail/internet/MimeBodyPart.html">MimeBodyPart</A> <B>createMimeBodyPart</B>(java.io.InputStream&nbsp;is)
                                   throws <A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Create and return a MimeBodyPart object to represent a
 body part parsed from the InputStream.  Subclasses can override
 this method to return a subclass of MimeBodyPart, if
 necessary.  This implementation simply constructs and returns
 a MimeBodyPart object.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>is</CODE> - InputStream containing the body part<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html">MessagingException</A></CODE> - &nbsp;<DT><B>Since: </B><DD>JavaMail 1.2</DD>
</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/internet/MimeMessage.RecipientType.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/mail/internet/MimePartDataSource.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="MimeMultipart.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;<A HREF="#constructor_summary">CONSTR</A>&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;<A HREF="#constructor_detail">CONSTR</A>&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 + -
显示快捷键?