java.lang.Object | +--javax.mail.MultipartKnown Direct Subclasses:
String | This field specifies the content-type of this multipart object. |
The Part containing this Multipart, if known. | |
List | List of BodyPart objects. |
Default constructor. |
synchronized void | addBodyPart(BodyPart part) Adds a Part to the multipart. |
synchronized void | addBodyPart(BodyPart part, int index) Adds a BodyPart at position index. |
getBodyPart(int index) Get the specified Part. | |
String | Return the content-type of this Multipart. |
int | getCount() Return the number of enclosed BodyPart objects. |
Return the Part that contains this Multipart object, or null if not known. | |
boolean | removeBodyPart(BodyPart part) Remove the specified part from the multipart message. |
void | removeBodyPart(int index) Remove the part at specified location (starting from 0). |
void | setMultipartDataSource(MultipartDataSource mp) Setup this Multipart object from the given MultipartDataSource. |
void | Set the parent of this Multipart to be the specified Part. |
void | writeTo(OutputStream os) Output an appropriately encoded bytestream to the given OutputStream. |
protected String contentType
protected Part parent
protected List parts
protected Multipart()
public synchronized void addBodyPart(BodyPart part)
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuespublic synchronized void addBodyPart(BodyPart part, int index)
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuespublic BodyPart getBodyPart(int index)
- if the given index is out of range.public String getContentType()
contentType
field.
public int getCount()
public Part getParent()
public void removeBodyPart(int index)
- if the given index is out of range.IllegalWriteException
- if the underlying implementation
does not support modification of existing valuespublic boolean removeBodyPart(BodyPart part)
MessagingException
- if no such Part existsIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesprotected void setMultipartDataSource(MultipartDataSource mp)
contentType
is set to that of
the MultipartDataSource.
This method is typically used in those cases where one has a multipart
data source that has already been pre-parsed into the individual body
parts (for example, an IMAP datasource), but needs to create an
appropriate Multipart subclass that represents a specific multipart
subtype.
public void setParent(Part part)
setContent(Multipart)
method. parent may be null if
the Multipart is being removed from its containing Part.
public void writeTo(OutputStream os)
getContent()
on a DataHandler whose source is a "multipart/signed" data source may return an appropriate subclass of Multipart. Some messaging systems provide different subtypes of Multiparts. For example, MIME specifies a set of subtypes that include "alternative", "mixed", "related", "parallel", "signed", etc. Multipart is an abstract class. Subclasses provide actual implementations.