|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.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 crafting a new MimeMessage.
The richer (i.e., semantically complex) "multipart" subtypes are implemented as subclasses of MimeMultipart. The intention 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.
Field Summary | |
protected javax.activation.DataSource |
ds
|
protected boolean |
parsed
|
Fields inherited from class javax.mail.Multipart |
contentType,
parent,
parts |
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 Part. |
BodyPart |
getBodyPart(java.lang.String CID)
Get the Mimepart 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. |
protected void |
updateHeaders()
Update headers. |
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,
setMultipartDataSource,
setParent |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected javax.activation.DataSource ds
protected boolean parsed
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 special cases the situation where the given DataSource is a MultipartDataSource object. In this case, this method just invokes the superclass (ie Multipart) constructor that takes a MultipartDataSource object. Else, the DataSource is assumed to provide a MIME multipart byte stream. The parser extracts the "boundary" parameter from contentType 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 MultipartDataSourceMethod Detail |
public void setSubType(java.lang.String subtype) throws MessagingException
subtype
- Subtypepublic int getCount() throws MessagingException
public BodyPart getBodyPart(int index) throws MessagingException
index
- the index of the desired Partpublic BodyPart getBodyPart(java.lang.String CID) throws MessagingException
CID
- the ContentID of the desired partprotected void updateHeaders() throws MessagingException
updateHeaders()
on each of its
children BodyParts. Note that the boundary parameter is already set up when a new and empty MimeMultipart object is created.
This method is called when the saveChanges
method is invoked on the Message object containing this
Multipart. This is typically done as part of the Message
send process, however note that a client is free to call
it any number of times. So if the header updation process is
expensive for a specific MimeMultipart subclass, then it
might itself want to track whether its internal state actually
did change, and do the header updation only if necessary.
public void writeTo(java.io.OutputStream os) throws java.io.IOException, MessagingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |