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
-
MimeMultipart()
- Constructor for
MimeMultipart
.
-
addBodyPart(MimeBodyPart)
- Adds a body part at the end of the list of body parts contained in this
multipart.
-
addBodyPart(MimeBodyPart, int)
- Inserts a body part in the list of body parts contained in this
multipart at the specified position.
-
decode(MimeMap)
- Decodes all the contained body parts using the specified
MimeMap
.
-
encode(MimeMap)
- Encodes all the contained body parts using the specified
MimeMap
.
-
getBodyPart(int)
- Returns the body part at the specified position.
-
getBodyParts()
- Returns an enumeration of all the body parts contained in this multipart.
-
getContentType()
- Returns the MIME data type of this multipart.
-
getPartsCount()
- Returns the count of body parts contained in this multipart.
-
getSubtype()
- Returns the sub type of the content type of this multipart.
-
putByteStream(OutputStream)
- Writes the headers and encoded data of all the contained body parts to the
specified
OutputStream
.
-
removeBodyPart(int)
- Removes the body part at the specified position from
the list of body parts contained by this multipart.
-
setContent(Object, String)
- Parses, creates body parts and adds them to its list
of contained body parts.
-
setSubtype(String)
-
Sets the subtype of this multipart's content type.
MimeMultipart
public MimeMultipart()
- Constructor for
MimeMultipart
.
Creates a MimeMultipart
without any body parts. Body parts
can be added using addBodyPart()
.
- See Also:
- addBodyPart, addBodyPart
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
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
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.
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.
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.
getBodyParts
public Enumeration getBodyParts()
- Returns an enumeration of all the body parts contained in this multipart.
- Returns:
- an enumeration of all contained body parts.
getContentType
public String getContentType()
- Returns the MIME data type of this multipart.
- Returns:
- the MIME data type of this multipart.
getPartsCount
public int getPartsCount()
- Returns the count of body parts contained in this multipart.
- Returns:
- the count of contained body parts.
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.
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
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.
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".
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