All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.network.mail.base.MimeMultipart

java.lang.Object
   |
   +----com.ibm.network.mail.base.MimeMultipart

public class MimeMultipart
extends Object
implements MimeStreamWriter, Encodable, Decodable
Multipart is a container that holds multiple body parts. Multipart provides methods to retrieve and set its subparts.

A MimeMultipart is obtained from a MimePart whose primary type is "multipart" (by invoking the part's getContent()) or it can be created by a client as part of crafting a new MimeMessage.

Author:
Abdul Majeed Ghadialy, Mohit M. Sant
See Also:
MimePart, MimeMessage, MimeBodyPart

Constructor Index

 o MimeMultipart()
Constructor for MimeMultipart.

Method Index

 o addBodyPart(MimeBodyPart)
Adds a body part at the end of the list of body parts contained in this multipart.
 o addBodyPart(MimeBodyPart, int)
Inserts a body part in the list of body parts contained in this multipart at the specified position.
 o decode(MimeMap)
Decodes all the contained body parts using the specified MimeMap.
 o encode(MimeMap)
Encodes all the contained body parts using the specified MimeMap.
 o getBodyPart(int)
Returns the body part at the specified position.
 o getBodyParts()
Returns an enumeration of all the body parts contained in this multipart.
 o getContentType()
Returns the MIME data type of this multipart.
 o getPartsCount()
Returns the count of body parts contained in this multipart.
 o getSubtype()
Returns the sub type of the content type of this multipart.
 o putByteStream(OutputStream)
Writes the headers and encoded data of all the contained body parts to the specified OutputStream.
 o removeBodyPart(int)
Removes the body part at the specified position from the list of body parts contained by this multipart.
 o setContent(Object, String)
Parses, creates body parts and adds them to its list of contained body parts.
 o setSubtype(String)
Sets the subtype of this multipart's content type.

Constructors

 o MimeMultipart
 public MimeMultipart()
Constructor for MimeMultipart. Creates a MimeMultipart without any body parts. Body parts can be added using addBodyPart().

See Also:
addBodyPart, addBodyPart

Methods

 o addBodyPart
 public void addBodyPart(MimeBodyPart mimeBodyPart)
Adds a body part at the end of the list of body parts contained in this multipart.

Parameters:
mimeBodyPart - body part to be added.
See Also:
addBodyPart
 o addBodyPart
 public void addBodyPart(MimeBodyPart mimeBodyPart,
                         int index)
Inserts a body part in the list of body parts contained in this multipart at the specified position. All the body parts at positions greater than index are moved to a position one greater than their earlier position.

Parameters:
mimeBodyPart - body part to be added.
index - the position where mimeBodyPart is to be inserted.
See Also:
addBodyPart
 o decode
 public void decode(MimeMap map)
Decodes all the contained body parts using the specified MimeMap. Mimemap specifies decoder to be used for a particular body part.

Parameters:
map - a map which specifies decoder to be used for a particular body part.
 o encode
 public void encode(MimeMap map)
Encodes all the contained body parts using the specified MimeMap. Mimemap specifies the encoder to be used for a particular body part.

Parameters:
map - a map which specifies the encoder to be used for a particular body part.
 o getBodyPart
 public MimeBodyPart getBodyPart(int index)
Returns the body part at the specified position.

Parameters:
index - index into the list of contained body parts.
Returns:
MimeBodyPart at the specified position.
 o getBodyParts
 public Enumeration getBodyParts()
Returns an enumeration of all the body parts contained in this multipart.

Returns:
an enumeration of all contained body parts.
 o getContentType
 public String getContentType()
Returns the MIME data type of this multipart.

Returns:
the MIME data type of this multipart.
 o getPartsCount
 public int getPartsCount()
Returns the count of body parts contained in this multipart.

Returns:
the count of contained body parts.
 o getSubtype
 public String getSubtype()
Returns the sub type of the content type of this multipart. Supported values are "mixed" and "alternative".

Returns:
the sub type of the Content-Type of this multipart.
 o putByteStream
 public void putByteStream(OutputStream os) throws IOException
Writes the headers and encoded data of all the contained body parts to the specified OutputStream.

Parameters:
os - OutputStream to write headers and contents of the contained parts.
Throws: IOException
in case an IO error is encountered.
See Also:
putByteStream, putByteStream
 o removeBodyPart
 public void removeBodyPart(int index)
Removes the body part at the specified position from the list of body parts contained by this multipart. All the body parts at positions greater than index are moved to a position one less than their earlier positions.

Parameters:
index - the position of the body part to be removed.
 o setContent
 public void setContent(Object content,
                        String type)
Parses, creates body parts and adds them to its list of contained body parts. Also sets the subtype of this multipart to type. In case of any error, sets the content of this multipart to null and returns. content should be of type java.io.BufferedReader or a sub class thereof. If the specified type is different from the one read from content, the latter will take precedence.

Parameters:
content - BufferedReader to be used to create body parts.
type - the subtype of this multipart's content type. Valid values are "mixed" and "alternative".
 o setSubtype
 public void setSubtype(String value)
Sets the subtype of this multipart's content type.

Parameters:
value - the subtype of this multipart's content type. Valid values are "mixed" and "alternative".

All Packages  Class Hierarchy  This Package  Previous  Next  Index