|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.mail.Multipart
javax.mail.internet.MimeMultipart
The MimeMultipart class is an implementation of the abstract Multipart class that uses MIME conventions for the multipart data.
A MimeMultipart is obtained from a MimePart whose primary type
is "multipart" (by invoking the part's getContent() method)
or it can be created by a client as part of creating a new MimeMessage.
The default multipart subtype is "mixed". The other multipart subtypes, such as "alternative", "related", and so on, can be implemented as subclasses of MimeMultipart with additional methods to implement the additional semantics of that type of multipart content. The intent is that service providers, mail JavaBean writers and mail clients will write many such subclasses and their Command Beans, and will install them into the JavaBeans Activation Framework, so that any JavaMail implementation and its clients can transparently find and use these classes. Thus, a MIME multipart handler is treated just like any other type handler, thereby decoupling the process of providing multipart handlers from the JavaMail API. Lacking these additional MimeMultipart subclasses, all subtypes of MIME multipart data appear as MimeMultipart objects.
An application can directly construct a MIME multipart object of any
subtype by using the MimeMultipart(String subtype)
constructor. For example, to create a "multipart/alternative" object,
use new MimeMultipart("alternative").
| Constructor Summary | |
MimeMultipart()
Default constructor. |
|
MimeMultipart(javax.activation.DataSource ds)
Constructs a MimeMultipart object and its bodyparts from the given DataSource. |
|
MimeMultipart(java.lang.String subtype)
Construct a MimeMultipart object of the given subtype. |
|
| Method Summary | |
BodyPart |
getBodyPart(int index)
Get the specified BodyPart. |
BodyPart |
getBodyPart(java.lang.String CID)
Get the MimeBodyPart referred to by the given ContentID (CID). |
int |
getCount()
Return the number of enclosed BodyPart objects. |
void |
setSubType(java.lang.String subtype)
Set the subtype. |
void |
writeTo(java.io.OutputStream os)
Iterates through all the parts and outputs each Mime part separated by a boundary. |
| Methods inherited from class javax.mail.Multipart |
addBodyPart, addBodyPart, getContentType, getParent, removeBodyPart, removeBodyPart, setParent |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MimeMultipart()
contentType field. MimeBodyParts may be added later.
public MimeMultipart(java.lang.String subtype)
contentType field. MimeBodyParts may be added later.
public MimeMultipart(javax.activation.DataSource ds)
throws MessagingException
This constructor handles as a special case the situation where the given DataSource is a MultipartDataSource object. In this case, this method just invokes the superclass (i.e., Multipart) constructor that takes a MultipartDataSource object.
Otherwise, the DataSource is assumed to provide a MIME multipart
byte stream. The parsed flag is set to false. When
the data for the body parts are needed, the parser extracts the
"boundary" parameter from the content type of this DataSource,
skips the 'preamble' and reads bytes till the terminating
boundary and creates MimeBodyParts for each part of the stream.
ds - DataSource, can be a MultipartDataSource| Method Detail |
public void setSubType(java.lang.String subtype)
throws MessagingException
subtype - Subtype
MessagingException
public int getCount()
throws MessagingException
getCount in class MultipartMessagingException#parts
public BodyPart getBodyPart(int index)
throws MessagingException
getBodyPart in class Multipartindex - the index of the desired BodyPart
MessagingException - if no such BodyPart exists
public BodyPart getBodyPart(java.lang.String CID)
throws MessagingException
CID - the ContentID of the desired part
MessagingException
public void writeTo(java.io.OutputStream os)
throws java.io.IOException,
MessagingException
writeTo in class Multipartjava.io.IOException - if an IO related exception occurs
MessagingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||