📄 part.java
字号:
* @return Filename to associate with this part */ public String getFileName() throws MessagingException; /** * 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. * * @param filename Filename to associate with this part * @exception IllegalWriteException if the underlying implementation * does not support modification of this header * @exception IllegalStateException if this Part is obtained * from a READ_ONLY folder */ public void setFileName(String filename) throws MessagingException; /** * 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. * * @return an InputStream * @exception IOException this is typically thrown by the * DataHandler. Refer to the documentation for * javax.activation.DataHandler for more details. * @exception MessagingException * @see #getDataHandler * @see javax.activation.DataHandler#getInputStream */ public InputStream getInputStream() throws IOException, MessagingException; /** * Return a DataHandler for the content within this part. The * DataHandler allows clients to operate on as well as retrieve * the content. * * @return DataHandler for the content * @exception MessagingException */ public DataHandler getDataHandler() throws MessagingException; /** * 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 * * @return Object * @exception MessagingException * @exception IOException this is typically thrown by the * DataHandler. Refer to the documentation for * javax.activation.DataHandler for more details. * * @see javax.activation.DataHandler#getContent */ public Object getContent() throws IOException, MessagingException; /** * This method provides the mechanism to set this part's content. * The DataHandler wraps around the actual content. * * @param dh The DataHandler for the content. * @exception MessagingException * @exception IllegalWriteException if the underlying implementation * does not support modification of existing values * @exception IllegalStateException if this Part is obtained * from a READ_ONLY folder */ public void setDataHandler(DataHandler dh) throws MessagingException; /** * 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. * * @param obj A java object. * @param type MIME type of this object. * @exception IllegalWriteException if the underlying implementation * does not support modification of existing values * @exception IllegalStateException if this Part is obtained * from a READ_ONLY folder */ public void setContent(Object obj, String type) throws MessagingException; /** * A convenience method that sets the given String as this * part's content with a MIME type of "text/plain". * * @param text The text that is the Message's content. * @exception IllegalWriteException if the underlying * implementation does not support modification of * existing values * @exception IllegalStateException if this Part is obtained * from a READ_ONLY folder */ public void setText(String text) throws MessagingException; /** * This method sets the given Multipart object as this message's * content. * * @param mp The multipart object that is the Message's content * @exception IllegalWriteException if the underlying * implementation does not support modification of * existing values * @exception IllegalStateException if this Part is obtained * from a READ_ONLY folder */ public void setContent(Multipart mp) throws MessagingException; /** * 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. * * @exception IOException if an error occurs writing to the * stream or if an error is generated * by the javax.activation layer. * @exception MessagingException if an error occurs fetching the * data to be written * * @see javax.activation.DataHandler#writeTo */ public void writeTo(OutputStream os) throws IOException, MessagingException; /** * Get all the headers for this header name. Returns <code>null</code> * if no headers for this header name are available. * * @param header_name the name of this header * @return the value fields for all headers with * this name * @exception MessagingException */ public String[] getHeader(String header_name) throws MessagingException; /** * Set the value for this header_name. Replaces all existing * header values with this new value. * * @param header_name the name of this header * @param header_value the value for this header * @exception MessagingException * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this Part is * obtained from a READ_ONLY folder */ public void setHeader(String header_name, String header_value) throws MessagingException; /** * Add this value to the existing values for this header_name. * * @param header_name the name of this header * @param header_value the value for this header * @exception MessagingException * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this Part is * obtained from a READ_ONLY folder */ public void addHeader(String header_name, String header_value) throws MessagingException; /** * Remove all headers with this name. * * @param header_name the name of this header * @exception MessagingException * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this Part is * obtained from a READ_ONLY folder */ public void removeHeader(String header_name) throws MessagingException; /** * Return all the headers from this part as an Enumeration of * Header objects. * * @return enumeration of Header objects * @exception MessagingException */ public Enumeration getAllHeaders() throws MessagingException; /** * Return matching headers from this part as an Enumeration of * Header objects. * * @return enumeration of Header objects * @exception MessagingException */ public Enumeration getMatchingHeaders(String[] header_names) throws MessagingException; /** * Return non-matching headers from this envelope as an Enumeration * of Header objects. * * @return enumeration of Header objects * @exception MessagingException */ public Enumeration getNonMatchingHeaders(String[] header_names) throws MessagingException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -