public class MimeMultipart extends Multipart
The default multipart subtype is "mixed". However, an application can
construct a MIME multipart object of any subtype using the
MimeMultipart(String) constructor.
| Modifier and Type | Field and Description |
|---|---|
protected DataSource |
ds
The data source supplying the multipart data.
|
protected boolean |
parsed
Indicates whether the data from the input stream has been parsed yet.
|
contentType, parent, parts| Constructor and Description |
|---|
MimeMultipart()
Constructor for an empty MIME multipart of type "multipart/mixed".
|
MimeMultipart(DataSource ds)
Constructor with a given data source.
|
MimeMultipart(String subtype)
Constructor for an empty MIME multipart of the given subtype.
|
| Modifier and Type | Method and Description |
|---|---|
protected InternetHeaders |
createInternetHeaders(InputStream is)
Creates headers from the specified input stream.
|
protected MimeBodyPart |
createMimeBodyPart(InputStream is)
Creates a MIME body part from the specified input stream.
|
protected MimeBodyPart |
createMimeBodyPart(InternetHeaders headers,
byte[] content)
Creates a MIME body part object from the given headers and byte content.
|
BodyPart |
getBodyPart(int index)
Returns the specified body part.
|
BodyPart |
getBodyPart(String CID)
Returns the body part identified by the given Content-ID (CID).
|
int |
getCount()
Returns the number of component body parts.
|
String |
getPreamble()
Returns the preamble text (if any) before the first boundary line in
this multipart's body.
|
boolean |
isComplete()
Indicates whether the final boundary line for this multipart has been
parsed.
|
protected void |
parse()
Parses the body parts from this multipart's data source.
|
void |
setPreamble(String preamble)
Sets the preamble text to be emitted before the first boundary line.
|
void |
setSubType(String subtype)
Sets the subtype.
|
protected void |
updateHeaders()
Updates the headers of this part to be consistent with its content.
|
void |
writeTo(OutputStream os)
Writes this multipart to the specified output stream.
|
addBodyPart, addBodyPart, getContentType, getParent, removeBodyPart, removeBodyPart, setMultipartDataSource, setParentprotected DataSource ds
protected boolean parsed
public MimeMultipart()
public MimeMultipart(String subtype)
public MimeMultipart(DataSource ds) throws MessagingException
ds - the data source, which can be a MultipartDataSourceMessagingExceptionpublic void setSubType(String subtype) throws MessagingException
MessagingExceptionpublic int getCount()
throws MessagingException
getCount in class MultipartMessagingExceptionpublic BodyPart getBodyPart(int index) throws MessagingException
getBodyPart in class Multipartindex - the body part indexMessagingException - if no such part existspublic BodyPart getBodyPart(String CID) throws MessagingException
CID - the Content-ID of the desired partMessagingExceptionprotected void updateHeaders()
throws MessagingException
MessagingExceptionpublic void writeTo(OutputStream os) throws IOException, MessagingException
writeTo in class MultipartIOExceptionMessagingExceptionprotected void parse()
throws MessagingException
MessagingExceptionpublic boolean isComplete()
throws MessagingException
MessagingExceptionpublic String getPreamble() throws MessagingException
MessagingExceptionpublic void setPreamble(String preamble) throws MessagingException
preamble - the preamble textMessagingExceptionprotected InternetHeaders createInternetHeaders(InputStream is) throws MessagingException
is - the input stream to read the headers fromMessagingExceptionprotected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content) throws MessagingException
headers - the part headerscontent - the part contentMessagingExceptionprotected MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException
is - the input stream to parse the part fromMessagingException© Copyright 2003, 2004 The Free Software Foundation, All rights reserved