javax.mail.internet
Class MimeMultipart

java.lang.Object
  extended by javax.mail.Multipart
      extended by javax.mail.internet.MimeMultipart

public class MimeMultipart
extends Multipart

Version:
$Rev: 689486 $ $Date: 2008-08-27 10:11:03 -0400 (Wed, 27 Aug 2008) $

Field Summary
protected  DataSource ds
          DataSource that provides our InputStream.
protected  boolean parsed
          Indicates if the data has been parsed.
 
Fields inherited from class javax.mail.Multipart
contentType, parent, parts
 
Constructor Summary
MimeMultipart()
          Create an empty MimeMultipart with content type "multipart/mixed"
MimeMultipart(DataSource dataSource)
          Create a MimeMultipart from the supplied DataSource.
MimeMultipart(String subtype)
          Create an empty MimeMultipart with the subtype supplied.
 
Method Summary
protected  InternetHeaders createInternetHeaders(InputStream in)
           
protected  MimeBodyPart createMimeBodyPart(InputStream in)
           
protected  MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] data)
           
 BodyPart getBodyPart(int part)
          Get the specified part; numbering starts at zero.
 BodyPart getBodyPart(String cid)
           
 int getCount()
          Return the number of enclosed parts
 String getPreamble()
          Returns the preamble text that appears before the first bady part of a MIME multi part.
 boolean isComplete()
          Return true if the final boundary line for this multipart was seen when parsing the data.
protected  void parse()
           
 void setPreamble(String preamble)
          Set the message preamble text.
 void setSubType(String subtype)
           
protected  void updateHeaders()
           
 void writeTo(OutputStream out)
          Encode and write this multipart to the supplied OutputStream; the encoding used is determined by the implementation.
 
Methods inherited from class javax.mail.Multipart
addBodyPart, addBodyPart, getContentType, getParent, removeBodyPart, removeBodyPart, setMultipartDataSource, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ds

protected DataSource ds
DataSource that provides our InputStream.


parsed

protected boolean parsed
Indicates if the data has been parsed.

Constructor Detail

MimeMultipart

public MimeMultipart()
Create an empty MimeMultipart with content type "multipart/mixed"


MimeMultipart

public MimeMultipart(String subtype)
Create an empty MimeMultipart with the subtype supplied.

Parameters:
subtype - the subtype

MimeMultipart

public MimeMultipart(DataSource dataSource)
              throws MessagingException
Create a MimeMultipart from the supplied DataSource.

Parameters:
dataSource - the DataSource to use
Throws:
MessagingException
Method Detail

setSubType

public void setSubType(String subtype)
                throws MessagingException
Throws:
MessagingException

getCount

public int getCount()
             throws MessagingException
Description copied from class: Multipart
Return the number of enclosed parts

Overrides:
getCount in class Multipart
Returns:
the number of parts
Throws:
MessagingException

getBodyPart

public BodyPart getBodyPart(int part)
                     throws MessagingException
Description copied from class: Multipart
Get the specified part; numbering starts at zero.

Overrides:
getBodyPart in class Multipart
Parameters:
part - the part to get
Returns:
the part
Throws:
MessagingException

getBodyPart

public BodyPart getBodyPart(String cid)
                     throws MessagingException
Throws:
MessagingException

updateHeaders

protected void updateHeaders()
                      throws MessagingException
Throws:
MessagingException

writeTo

public void writeTo(OutputStream out)
             throws IOException,
                    MessagingException
Description copied from class: Multipart
Encode and write this multipart to the supplied OutputStream; the encoding used is determined by the implementation.

Specified by:
writeTo in class Multipart
Parameters:
out - the stream to write to
Throws:
IOException
MessagingException

parse

protected void parse()
              throws MessagingException
Throws:
MessagingException

createInternetHeaders

protected InternetHeaders createInternetHeaders(InputStream in)
                                         throws MessagingException
Throws:
MessagingException

createMimeBodyPart

protected MimeBodyPart createMimeBodyPart(InternetHeaders headers,
                                          byte[] data)
                                   throws MessagingException
Throws:
MessagingException

createMimeBodyPart

protected MimeBodyPart createMimeBodyPart(InputStream in)
                                   throws MessagingException
Throws:
MessagingException

isComplete

public boolean isComplete()
                   throws MessagingException
Return true if the final boundary line for this multipart was seen when parsing the data.

Returns:
Throws:
MessagingException

getPreamble

public String getPreamble()
                   throws MessagingException
Returns the preamble text that appears before the first bady part of a MIME multi part. The preamble is optional, so this might be null.

Returns:
The preamble text string.
Throws:
MessagingException

setPreamble

public void setPreamble(String preamble)
                 throws MessagingException
Set the message preamble text. This will be written before the first boundary of a multi-part message.

Parameters:
preamble - The new boundary text. This is complete lines of text, including new lines.
Throws:
MessagingException


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.