📄 part.html
字号:
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>java.io.IOException - this is typically thrown by the
DataHandler. Refer to the documentation for
javax.activation.DataHandler for more details.<DD><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - <DT><B>See Also: </B><DD><A HREF="../../javax/mail/Part.html#getDataHandler()"><CODE>getDataHandler()</CODE></A>,
<CODE>DataHandler.getInputStream()</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getDataHandler()"><!-- --></A><H3>
getDataHandler</H3>
<PRE>
public javax.activation.DataHandler <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><A HREF="../../javax/mail/MessagingException.html">MessagingException</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 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - <DD>java.io.IOException - this is typically thrown by the
DataHandler. Refer to the documentation for
javax.activation.DataHandler for more details.<DT><B>See Also: </B><DD><CODE>DataHandler.getContent()</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="setDataHandler(javax.activation.DataHandler)"><!-- --></A><H3>
setDataHandler</H3>
<PRE>
public void <B>setDataHandler</B>(javax.activation.DataHandler 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - <DD><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying implementation
does not support modification of existing values<DD>IllegalStateException - 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 obj,
java.lang.String 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><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying implementation
does not support modification of existing values<DD>IllegalStateException - 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 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><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying
implementation does not support modification of
existing values<DD>IllegalStateException - 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> 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><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying
implementation does not support modification of
existing values<DD>IllegalStateException - 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 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>java.io.IOException - if an error occurs writing to the
stream or if an error is generated
by the javax.activation layer.<DD><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - if an error occurs fetching the
data to be written<DT><B>See Also: </B><DD><CODE>DataHandler.writeTo(java.io.OutputStream)</CODE></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 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - </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 header_name,
java.lang.String 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - <DD><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying
implementation does not support modification
of existing values<DD>IllegalStateException - 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 header_name,
java.lang.String 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - <DD><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying
implementation does not support modification
of existing values<DD>IllegalStateException - 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 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - <DD><A HREF="../../javax/mail/IllegalWriteException.html">IllegalWriteException</A> - if the underlying
implementation does not support modification
of existing values<DD>IllegalStateException - 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - </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[] 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - </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[] 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><A HREF="../../javax/mail/MessagingException.html">MessagingException</A> - </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" ID="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="class-use/Part.html"><FONT ID="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/mail/MultipartDataSource.html"><B>PREV CLASS</B></A>
<A HREF="../../javax/mail/UIDFolder.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Part.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -