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 boolean |
allowEmpty
Flag corresponding to the
mail.mime.multipart.allowempty
property, set in initializeProperties() which is called from
constructors and the parse method. |
protected boolean |
complete
Indicates whether the final boundary line of the multipart has been
seen.
|
protected javax.activation.DataSource |
ds
The data source supplying the multipart data.
|
protected boolean |
ignoreExistingBoundaryParameter
Flag corresponding to the
mail.mime.multipart.ignoreexistingboundaryparameter
property, set in initializeProperties() which is called from
constructors and the parse method. |
protected boolean |
ignoreMissingBoundaryParameter
Flag corresponding to the
mail.mime.multipart.ignoremissingboundaryparameter
property, set in initializeProperties() which is called from
constructors and the parse method. |
protected boolean |
ignoreMissingEndBoundary
Flag corresponding to the
mail.mime.multipart.ignoremissingendboundary
property, set in initializeProperties() which is called from
constructors and the parse method. |
protected boolean |
parsed
Indicates whether the data from the input stream has been parsed yet.
|
protected java.lang.String |
preamble
The preamble text before the first boundary line.
|
contentType, parent, parts
Constructor and Description |
---|
MimeMultipart()
Constructor for an empty MIME multipart of type "multipart/mixed".
|
MimeMultipart(BodyPart... parts)
Constructor with the "mixed" subtype and specified body parts.
|
MimeMultipart(javax.activation.DataSource ds)
Constructor with a given data source.
|
MimeMultipart(java.lang.String subtype)
Constructor for an empty MIME multipart of the given subtype.
|
MimeMultipart(java.lang.String subtype,
BodyPart... parts)
Constructor with the specified subtype and body parts.
|
Modifier and Type | Method and Description |
---|---|
protected InternetHeaders |
createInternetHeaders(java.io.InputStream is)
Creates headers from the specified input stream.
|
protected MimeBodyPart |
createMimeBodyPart(java.io.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(java.lang.String CID)
Returns the body part identified by the given Content-ID (CID).
|
int |
getCount()
Returns the number of component body parts.
|
java.lang.String |
getPreamble()
Returns the preamble text (if any) before the first boundary line in
this multipart's body.
|
protected void |
initializeProperties()
Initialize various flags that control parsing behavior.
|
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(java.lang.String preamble)
Sets the preamble text to be emitted before the first boundary line.
|
void |
setSubType(java.lang.String subtype)
Sets the subtype.
|
protected void |
updateHeaders()
Updates the headers of this part to be consistent with its content.
|
void |
writeTo(java.io.OutputStream os)
Writes this multipart to the specified output stream.
|
addBodyPart, addBodyPart, getContentType, getParent, removeBodyPart, removeBodyPart, setMultipartDataSource, setParent
protected javax.activation.DataSource ds
protected boolean parsed
protected boolean complete
protected java.lang.String preamble
protected boolean ignoreMissingEndBoundary
mail.mime.multipart.ignoremissingendboundary
property, set in initializeProperties()
which is called from
constructors and the parse method.protected boolean ignoreMissingBoundaryParameter
mail.mime.multipart.ignoremissingboundaryparameter
property, set in initializeProperties()
which is called from
constructors and the parse method.protected boolean ignoreExistingBoundaryParameter
mail.mime.multipart.ignoreexistingboundaryparameter
property, set in initializeProperties()
which is called from
constructors and the parse method.protected boolean allowEmpty
mail.mime.multipart.allowempty
property, set in initializeProperties()
which is called from
constructors and the parse method.public MimeMultipart()
public MimeMultipart(java.lang.String subtype)
public MimeMultipart(javax.activation.DataSource ds) throws MessagingException
ds
- the data source, which can be a MultipartDataSourceMessagingException
public MimeMultipart(BodyPart... parts) throws MessagingException
MessagingException
public MimeMultipart(java.lang.String subtype, BodyPart... parts) throws MessagingException
MessagingException
protected void initializeProperties()
public void setSubType(java.lang.String subtype) throws MessagingException
MessagingException
public int getCount() throws MessagingException
getCount
in class Multipart
MessagingException
public BodyPart getBodyPart(int index) throws MessagingException
getBodyPart
in class Multipart
index
- the body part indexMessagingException
- if no such part existspublic BodyPart getBodyPart(java.lang.String CID) throws MessagingException
CID
- the Content-ID of the desired partMessagingException
protected void updateHeaders() throws MessagingException
MessagingException
public void writeTo(java.io.OutputStream os) throws java.io.IOException, MessagingException
writeTo
in class Multipart
java.io.IOException
MessagingException
protected void parse() throws MessagingException
MessagingException
public boolean isComplete() throws MessagingException
MessagingException
public java.lang.String getPreamble() throws MessagingException
MessagingException
public void setPreamble(java.lang.String preamble) throws MessagingException
preamble
- the preamble textMessagingException
protected InternetHeaders createInternetHeaders(java.io.InputStream is) throws MessagingException
is
- the input stream to read the headers fromMessagingException
protected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content) throws MessagingException
headers
- the part headerscontent
- the part contentMessagingException
protected MimeBodyPart createMimeBodyPart(java.io.InputStream is) throws MessagingException
is
- the input stream to parse the part fromMessagingException