📄 part.html
字号:
If the <code>subType</code> of <code>mimeType</code> is the special character '*', then the subtype is ignored during the comparison.<P><DD><DL><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="getDisposition()"><!-- --></A><H3>getDisposition</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>getDisposition</B>() throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Return the disposition of this part. The disposition describes how the part should be presented to the user. (See RFC 2183.) The return value should be considered without regard to case. For example: <p> <blockquote><pre> String disp = part.getDisposition(); if (disp == null || disp.equalsIgnoreCase(Part.ATTACHMENT)) // treat as attachment if not first part </pre></blockquote><P><DD><DL><DT><B>Returns:</B><DD>disposition of this part, or null if unknown<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/Part.html#ATTACHMENT"><CODE>ATTACHMENT</CODE></A>, <A HREF="../../javax/mail/Part.html#INLINE"><CODE>INLINE</CODE></A>, <A HREF="../../javax/mail/Part.html#getFileName()"><CODE>getFileName()</CODE></A></DL></DD></DL><HR><A NAME="setDisposition(java.lang.String)"><!-- --></A><H3>setDisposition</H3><PRE>public void <B>setDisposition</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> disposition) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Set the disposition of this part.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>disposition</CODE> - disposition of this 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 this header<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this Part is obtained from a READ_ONLY folder<DT><B>See Also:</B><DD><A HREF="../../javax/mail/Part.html#ATTACHMENT"><CODE>ATTACHMENT</CODE></A>, <A HREF="../../javax/mail/Part.html#INLINE"><CODE>INLINE</CODE></A>, <A HREF="../../javax/mail/Part.html#setFileName(java.lang.String)"><CODE>setFileName(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getDescription()"><!-- --></A><H3>getDescription</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>getDescription</B>() throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Return a description String for this part. This typically associates some descriptive information with this part. Returns null if none is available.<P><DD><DL><DT><B>Returns:</B><DD>description of this 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="setDescription(java.lang.String)"><!-- --></A><H3>setDescription</H3><PRE>public void <B>setDescription</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> description) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Set a description String for this part. This typically associates some descriptive information with this part.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>description</CODE> - description of this 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 this header<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this Part is obtained from a READ_ONLY folder</DL></DD></DL><HR><A NAME="getFileName()"><!-- --></A><H3>getFileName</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>getFileName</B>() throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Get the filename associated with this part, if possible. Useful if this part represents an "attachment" that was loaded from a file. The filename will usually be a simple name, not including directory components.<P><DD><DL><DT><B>Returns:</B><DD>Filename to associate with this 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="setFileName(java.lang.String)"><!-- --></A><H3>setFileName</H3><PRE>public void <B>setFileName</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> filename) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Set the filename associated with this part, if possible. Useful if this part represents an "attachment" that was loaded from a file. The filename will usually be a simple name, not including directory components.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - Filename to associate with this part<DT><B>Throws:</B><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 this header<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this Part is obtained from a READ_ONLY folder<DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="getInputStream()"><!-- --></A><H3>getInputStream</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> <B>getInputStream</B>() 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>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.<P><DD><DL><DT><B>Returns:</B><DD>an InputStream<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> - this is typically thrown by the DataHandler. Refer to the documentation for javax.activation.DataHandler for more details.<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/Part.html#getDataHandler()"><CODE>getDataHandler()</CODE></A>, <A HREF="../../javax/activation/DataHandler.html#getInputStream()"><CODE>DataHandler.getInputStream()</CODE></A></DL></DD></DL><HR><A NAME="getDataHandler()"><!-- --></A><H3>getDataHandler</H3><PRE>public <A HREF="../../javax/activation/DataHandler.html" title="class in javax.activation">DataHandler</A> <B>getDataHandler</B>() throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">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.<P><DD><DL><DT><B>Returns:</B><DD>DataHandler for the content<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="getContent()"><!-- --></A><H3>getContent</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getContent</B>() 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>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<P><DD><DL><DT><B>Returns:</B><DD>Object<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/io/IOException.html" title="class or interface in java.io">IOException</A></CODE> - this is typically thrown by the DataHandler. Refer to the documentation for javax.activation.DataHandler for more details.<DT><B>See Also:</B><DD><A HREF="../../javax/activation/DataHandler.html#getContent()"><CODE>DataHandler.getContent()</CODE></A></DL></DD></DL><HR><A NAME="setDataHandler(javax.activation.DataHandler)"><!-- --></A><H3>setDataHandler</H3><PRE>public void <B>setDataHandler</B>(<A HREF="../../javax/activation/DataHandler.html" title="class in javax.activation">DataHandler</A> dh) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>This method provides the mechanism to set this part's content. The DataHandler wraps around the actual content.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dh</CODE> - The DataHandler for the content.<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<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - 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>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> obj, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> type) throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">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.<P><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><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<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this Part is obtained from a READ_ONLY folder<DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="setText(java.lang.String)"><!-- --></A><H3>setText</H3><PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -