📄 part.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Fri Feb 18 09:55:58 PST 2000 -->
<TITLE>
JavaMail 1.1 API documentation: Interface Part
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_top_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>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.mail</FONT>
<BR>
Interface Part</H2>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../javax/mail/internet/MimePart.html">MimePart</A></DD>
</DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../javax/mail/BodyPart.html">BodyPart</A>, <A HREF="../../javax/mail/Message.html">Message</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract interface <B>Part</B></DL>
<P>
The <code>Part</code> interface is the common base interface for
Messages and BodyParts. <p>
Part consists of a set of attributes and a "Content".<p>
<strong> Attributes: </strong> <p>
The JavaMail API defines a set of standard Part attributes that are
considered to be common to most existing Mail systems. These
attributes have their own settor and gettor methods. Mail systems
may support other Part attributes as well, these are represented as
name-value pairs where both the name and value are Strings.<p>
<strong> Content: </strong> <p>
The <strong>data type</strong> of the "content" is returned by
the <code>getContentType()</code> method. The MIME typing system
is used to name data types. <p>
The "content" of a Part is available in various formats:
<ul>
<li> As a DataHandler - using the <code>getDataHandler()</code> method.
The "content" of a Part is also available through a
<code>javax.activation.DataHandler</code> object. The DataHandler
object allows clients to discover the operations available on the
content, and to instantiate the appropriate component to perform
those operations.
<li> As an input stream - using the <code>getInputStream()</code> method.
Any mail-specific encodings are decoded before this stream is returned
<li> As a java object - using the <code>getContent()</code> method.
This method returns the "content" as a Java object.
The returned object is of course dependent on the content
itself. In particular, a "multipart" Part's content is always a
Multipart or subclass thereof. ie <code>getContent()</code> on a
"multipart" type Part will always return a Multipart (or subclass) object.
</ul>
Part provides the <code>writeTo()</code> method that streams
out its bytestream in mail-safe form suitable for transmission.
This bytestream is typically an aggregation of the Part attributes
and its content's bytestream. <p>
Message and BodyPart implement the Part interface. Note that in
MIME parlance, Part models an Entity (RFC2045, Section 2.4)
<P>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#ATTACHMENT">ATTACHMENT</A></B></CODE>
<BR>
This part should be presented as an attachment.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#INLINE">INLINE</A></B></CODE>
<BR>
This part should be presented inline.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#addHeader(java.lang.String, java.lang.String)">addHeader</A></B>(java.lang.String header_name,
java.lang.String header_value)</CODE>
<BR>
Add this value to the existing values for this header_name.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Enumeration</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getAllHeaders()">getAllHeaders</A></B>()</CODE>
<BR>
Return all the headers from this part as an Enumeration of
Header objects.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getContent()">getContent</A></B>()</CODE>
<BR>
Return the content as a Java object.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getContentType()">getContentType</A></B>()</CODE>
<BR>
Returns the Content-Type of the content of this part.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> javax.activation.DataHandler</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getDataHandler()">getDataHandler</A></B>()</CODE>
<BR>
Return a DataHandler for the content within this part.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getDescription()">getDescription</A></B>()</CODE>
<BR>
Return a description String for this part.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getDisposition()">getDisposition</A></B>()</CODE>
<BR>
Return the disposition of this part.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getFileName()">getFileName</A></B>()</CODE>
<BR>
Get the filename associated with this part, if possible.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getHeader(java.lang.String)">getHeader</A></B>(java.lang.String header_name)</CODE>
<BR>
Get all the headers for this header name.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getInputStream()">getInputStream</A></B>()</CODE>
<BR>
Return an input stream for this part's "content".</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getLineCount()">getLineCount</A></B>()</CODE>
<BR>
Return the number of lines in the content of this part.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Enumeration</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getMatchingHeaders(java.lang.String[])">getMatchingHeaders</A></B>(java.lang.String[] header_names)</CODE>
<BR>
Return matching headers from this part as an Enumeration of
Header objects.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.util.Enumeration</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getNonMatchingHeaders(java.lang.String[])">getNonMatchingHeaders</A></B>(java.lang.String[] header_names)</CODE>
<BR>
Return non-matching headers from this envelope as an Enumeration
of Header objects.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#getSize()">getSize</A></B>()</CODE>
<BR>
Return the size of the content of this part in bytes.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#isMimeType(java.lang.String)">isMimeType</A></B>(java.lang.String mimeType)</CODE>
<BR>
Is this Part of the specified MIME type? This method
compares <strong>only the <code>primaryType</code> and
<code>subType</code></strong>.</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Part.html#removeHeader(java.lang.String)">removeHeader</A></B>(java.lang.String header_name)</CODE>
<BR>
Remove all headers with this name.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -