Methods Summary |
---|
public void | addHeader(java.lang.String header_name, java.lang.String header_value)Add this value to the existing values for this header_name.
|
public java.util.Enumeration | getAllHeaders()Return all the headers from this part as an Enumeration of
Header objects.
|
public java.lang.Object | getContent()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
This is a convenience method that just invokes the DataHandler's
getContent() method
|
public java.lang.String | getContentType()Returns the Content-Type of the content of this part.
Returns null if the Content-Type could not be determined.
The MIME typing system is used to name Content-types.
|
public javax.activation.DataHandler | getDataHandler()Return a DataHandler for the content within this part. The
DataHandler allows clients to operate on as well as retrieve
the content.
|
public java.lang.String | getDescription()Return a description String for this part. This typically
associates some descriptive information with this part.
Returns null if none is available.
|
public java.lang.String | getDisposition()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:
String disp = part.getDisposition();
if (disp == null || disp.equalsIgnoreCase(Part.ATTACHMENT))
// treat as attachment if not first part
|
public java.lang.String | getFileName()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.
|
public java.lang.String[] | getHeader(java.lang.String header_name)Get all the headers for this header name. Returns null
if no headers for this header name are available.
|
public java.io.InputStream | getInputStream()Return an input stream for this part's "content". Any
mail-specific transfer encodings will be decoded before the
input stream is provided.
This is typically a convenience method that just invokes
the DataHandler's getInputStream() method.
|
public int | getLineCount()Return the number of lines in the content of this part.
Return -1 if the number cannot be determined.
Note that this number may not be an exact measure of the
content length and may or may not account for any transfer
encoding of the content.
|
public java.util.Enumeration | getMatchingHeaders(java.lang.String[] header_names)Return matching headers from this part as an Enumeration of
Header objects.
|
public java.util.Enumeration | getNonMatchingHeaders(java.lang.String[] header_names)Return non-matching headers from this envelope as an Enumeration
of Header objects.
|
public int | getSize()Return the size of the content of this part in bytes.
Return -1 if the size cannot be determined.
Note that the size may not be an exact measure of the content
size and may or may not account for any transfer encoding
of the content. The size is appropriate for display in a
user interface to give the user a rough idea of the size
of this part.
|
public boolean | isMimeType(java.lang.String mimeType)Is this Part of the specified MIME type? This method
compares only the primaryType and
subType .
The parameters of the content types are ignored.
For example, this method will return true when
comparing a Part of content type "text/plain"
with "text/plain; charset=foobar".
If the subType of mimeType is the
special character '*', then the subtype is ignored during the
comparison.
|
public void | removeHeader(java.lang.String header_name)Remove all headers with this name.
|
public void | setContent(java.lang.Object obj, java.lang.String type)A convenience method for setting this part's content. The part
internally wraps the content in a DataHandler.
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 setContent(foobar, "application/x-foobar") ,
a DataContentHandler for "application/x-foobar" should be installed.
Refer to the Java Activation Framework for more information.
|
public void | setContent(javax.mail.Multipart mp)This method sets the given Multipart object as this message's
content.
|
public void | setDataHandler(javax.activation.DataHandler dh)This method provides the mechanism to set this part's content.
The DataHandler wraps around the actual content.
|
public void | setDescription(java.lang.String description)Set a description String for this part. This typically
associates some descriptive information with this part.
|
public void | setDisposition(java.lang.String disposition)Set the disposition of this part.
|
public void | setFileName(java.lang.String filename)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.
|
public void | setHeader(java.lang.String header_name, java.lang.String header_value)Set the value for this header_name. Replaces all existing
header values with this new value.
|
public void | setText(java.lang.String text)A convenience method that sets the given String as this
part's content with a MIME type of "text/plain".
|
public void | writeTo(java.io.OutputStream os)Output a bytestream for this Part. This bytestream is
typically an aggregration of the Part attributes and
an appropriately encoded bytestream from its 'content'.
Classes that implement the Part interface decide on
the appropriate encoding algorithm to be used.
The bytestream is typically used for sending.
|