javax.mail.internet
Class MimeMessage

java.lang.Object
  extended byjavax.mail.Message
      extended byjavax.mail.internet.MimeMessage
All Implemented Interfaces:
MimePart, Part

public class MimeMessage
extends Message
implements MimePart

Version:
$Revision: 1.3 $ $Date: 2004/03/10 10:00:28 $

Nested Class Summary
static class MimeMessage.RecipientType
           
 
Field Summary
protected  byte[] content
           
protected  InputStream contentStream
           
protected  javax.activation.DataHandler dh
           
protected  Flags flags
           
protected  InternetHeaders headers
           
protected  boolean modified
           
protected  boolean saved
           
 
Fields inherited from class javax.mail.Message
expunged, folder, msgnum, session
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
protected MimeMessage(Folder folder, InputStream in, int number)
           
protected MimeMessage(Folder folder, int number)
           
protected MimeMessage(Folder folder, InternetHeaders headers, byte[] content, int number)
           
  MimeMessage(MimeMessage message)
           
  MimeMessage(Session session)
           
  MimeMessage(Session session, InputStream in)
           
 
Method Summary
 void addFrom(Address[] address)
           
 void addHeader(String name, String value)
           
 void addHeaderLine(String line)
           
 void addRecipients(Message.RecipientType type, Address[] address)
           
 void addRecipients(Message.RecipientType type, String address)
           
protected  InternetHeaders createInternetHeaders(InputStream in)
           
 Enumeration getAllHeaderLines()
           
 Enumeration getAllHeaders()
           
 Address[] getAllRecipients()
           
 Object getContent()
           
 String getContentID()
           
 String[] getContentLanguage()
           
 String getContentMD5()
           
protected  InputStream getContentStream()
           
 String getContentType()
           
 javax.activation.DataHandler getDataHandler()
           
 String getDescription()
           
 String getDisposition()
           
 String getEncoding()
           
 String getFileName()
           
 Flags getFlags()
           
 Address[] getFrom()
           
 String[] getHeader(String name)
           
 String getHeader(String name, String delimiter)
           
 InputStream getInputStream()
           
 int getLineCount()
           
 Enumeration getMatchingHeaderLines(String[] names)
           
 Enumeration getMatchingHeaders(String[] names)
           
 String getMessageID()
           
 Enumeration getNonMatchingHeaderLines(String[] names)
           
 Enumeration getNonMatchingHeaders(String[] names)
           
 InputStream getRawInputStream()
           
 Date getReceivedDate()
           
 Address[] getRecipients(Message.RecipientType type)
           
 Address[] getReplyTo()
           
 Address getSender()
           
 Date getSentDate()
           
 int getSize()
           
 String getSubject()
           
 boolean isMimeType(String type)
           
 boolean isSet(Flags.Flag flag)
           
protected  void parse(InputStream in)
           
 void removeHeader(String name)
           
 Message reply(boolean replyToAll)
           
 void saveChanges()
           
 void setContent(Multipart part)
           
 void setContent(Object content, String type)
           
 void setContentID(String cid)
           
 void setContentLanguage(String[] languages)
           
 void setContentMD5(String md5)
           
 void setDataHandler(javax.activation.DataHandler handler)
           
 void setDescription(String description)
           
 void setDescription(String description, String charset)
           
 void setDisposition(String disposition)
           
 void setFileName(String name)
           
 void setFlags(Flags flags, boolean set)
           
 void setFrom()
           
 void setFrom(Address address)
           
 void setHeader(String name, String value)
           
 void setRecipients(Message.RecipientType type, Address[] address)
           
 void setRecipients(Message.RecipientType type, String address)
           
 void setReplyTo(Address[] address)
           
 void setSender(Address address)
           
 void setSentDate(Date sent)
           
 void setSubject(String subject)
           
 void setSubject(String subject, String charset)
           
 void setText(String text)
           
 void setText(String text, String charset)
           
protected  void updateHeaders()
           
 void writeTo(OutputStream out)
           
 void writeTo(OutputStream out, String[] ignoreHeaders)
           
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

content

protected byte[] content

contentStream

protected InputStream contentStream

dh

protected javax.activation.DataHandler dh

flags

protected Flags flags

headers

protected InternetHeaders headers

modified

protected boolean modified

saved

protected boolean saved
Constructor Detail

MimeMessage

protected MimeMessage(Folder folder,
                      InputStream in,
                      int number)
               throws MessagingException

MimeMessage

protected MimeMessage(Folder folder,
                      int number)

MimeMessage

protected MimeMessage(Folder folder,
                      InternetHeaders headers,
                      byte[] content,
                      int number)
               throws MessagingException

MimeMessage

public MimeMessage(MimeMessage message)
            throws MessagingException

MimeMessage

public MimeMessage(Session session)

MimeMessage

public MimeMessage(Session session,
                   InputStream in)
            throws MessagingException
Method Detail

addFrom

public void addFrom(Address[] address)
             throws MessagingException
Specified by:
addFrom in class Message
Throws:
MessagingException

addHeader

public void addHeader(String name,
                      String value)
               throws MessagingException
Specified by:
addHeader in interface Part
Throws:
MessagingException

addHeaderLine

public void addHeaderLine(String line)
                   throws MessagingException
Specified by:
addHeaderLine in interface MimePart
Throws:
MessagingException

addRecipients

public void addRecipients(Message.RecipientType type,
                          Address[] address)
                   throws MessagingException
Specified by:
addRecipients in class Message
Throws:
MessagingException

addRecipients

public void addRecipients(Message.RecipientType type,
                          String address)
                   throws MessagingException
Throws:
MessagingException

createInternetHeaders

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

getAllHeaderLines

public Enumeration getAllHeaderLines()
                              throws MessagingException
Specified by:
getAllHeaderLines in interface MimePart
Throws:
MessagingException

getAllHeaders

public Enumeration getAllHeaders()
                          throws MessagingException
Specified by:
getAllHeaders in interface Part
Throws:
MessagingException

getAllRecipients

public Address[] getAllRecipients()
                           throws MessagingException
Overrides:
getAllRecipients in class Message
Throws:
MessagingException

getContent

public Object getContent()
                  throws IOException
Specified by:
getContent in interface Part
Throws:
IOException

getContentID

public String getContentID()
                    throws MessagingException
Specified by:
getContentID in interface MimePart
Throws:
MessagingException

getContentLanguage

public String[] getContentLanguage()
                            throws MessagingException
Specified by:
getContentLanguage in interface MimePart
Throws:
MessagingException

getContentMD5

public String getContentMD5()
                     throws MessagingException
Specified by:
getContentMD5 in interface MimePart
Throws:
MessagingException

getContentStream

protected InputStream getContentStream()
                                throws MessagingException
Throws:
MessagingException

getContentType

public String getContentType()
                      throws MessagingException
Specified by:
getContentType in interface Part
Throws:
MessagingException

getDataHandler

public javax.activation.DataHandler getDataHandler()
                                            throws MessagingException
Specified by:
getDataHandler in interface Part
Throws:
MessagingException

getDescription

public String getDescription()
                      throws MessagingException
Specified by:
getDescription in interface Part
Throws:
MessagingException

getDisposition

public String getDisposition()
                      throws MessagingException
Specified by:
getDisposition in interface Part
Throws:
MessagingException

getEncoding

public String getEncoding()
                   throws MessagingException
Specified by:
getEncoding in interface MimePart
Throws:
MessagingException

getFileName

public String getFileName()
                   throws MessagingException
Specified by:
getFileName in interface Part
Throws:
MessagingException

getFlags

public Flags getFlags()
               throws MessagingException
Specified by:
getFlags in class Message
Throws:
MessagingException

getFrom

public Address[] getFrom()
                  throws MessagingException
Specified by:
getFrom in class Message
Throws:
MessagingException

getHeader

public String[] getHeader(String name)
                   throws MessagingException
Specified by:
getHeader in interface Part
Throws:
MessagingException

getHeader

public String getHeader(String name,
                        String delimiter)
                 throws MessagingException
Specified by:
getHeader in interface MimePart
Throws:
MessagingException

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface Part
Throws:
IOException

getLineCount

public int getLineCount()
                 throws MessagingException
Specified by:
getLineCount in interface Part
Throws:
MessagingException

getMatchingHeaderLines

public Enumeration getMatchingHeaderLines(String[] names)
                                   throws MessagingException
Specified by:
getMatchingHeaderLines in interface MimePart
Throws:
MessagingException

getMatchingHeaders

public Enumeration getMatchingHeaders(String[] names)
                               throws MessagingException
Specified by:
getMatchingHeaders in interface Part
Throws:
MessagingException

getMessageID

public String getMessageID()
                    throws MessagingException
Throws:
MessagingException

getNonMatchingHeaderLines

public Enumeration getNonMatchingHeaderLines(String[] names)
                                      throws MessagingException
Specified by:
getNonMatchingHeaderLines in interface MimePart
Throws:
MessagingException

getNonMatchingHeaders

public Enumeration getNonMatchingHeaders(String[] names)
                                  throws MessagingException
Specified by:
getNonMatchingHeaders in interface Part
Throws:
MessagingException

getRawInputStream

public InputStream getRawInputStream()
                              throws MessagingException
Throws:
MessagingException

getReceivedDate

public Date getReceivedDate()
                     throws MessagingException
Specified by:
getReceivedDate in class Message
Throws:
MessagingException

getRecipients

public Address[] getRecipients(Message.RecipientType type)
                        throws MessagingException
Specified by:
getRecipients in class Message
Throws:
MessagingException

getReplyTo

public Address[] getReplyTo()
                     throws MessagingException
Overrides:
getReplyTo in class Message
Throws:
MessagingException

getSender

public Address getSender()
                  throws MessagingException
Throws:
MessagingException

getSentDate

public Date getSentDate()
                 throws MessagingException
Specified by:
getSentDate in class Message
Throws:
MessagingException

getSize

public int getSize()
            throws MessagingException
Specified by:
getSize in interface Part
Throws:
MessagingException

getSubject

public String getSubject()
                  throws MessagingException
Specified by:
getSubject in class Message
Throws:
MessagingException

isMimeType

public boolean isMimeType(String type)
                   throws MessagingException
Specified by:
isMimeType in interface Part
Throws:
MessagingException

isSet

public boolean isSet(Flags.Flag flag)
              throws MessagingException
Overrides:
isSet in class Message
Throws:
MessagingException

parse

protected void parse(InputStream in)
              throws MessagingException
Throws:
MessagingException

removeHeader

public void removeHeader(String name)
                  throws MessagingException
Specified by:
removeHeader in interface Part
Throws:
MessagingException

reply

public Message reply(boolean replyToAll)
              throws MessagingException
Specified by:
reply in class Message
Throws:
MessagingException

saveChanges

public void saveChanges()
                 throws MessagingException
Specified by:
saveChanges in class Message
Throws:
MessagingException

setContent

public void setContent(Multipart part)
                throws MessagingException
Specified by:
setContent in interface Part
Throws:
MessagingException

setContent

public void setContent(Object content,
                       String type)
                throws MessagingException
Specified by:
setContent in interface Part
Throws:
MessagingException

setContentID

public void setContentID(String cid)
                  throws MessagingException
Throws:
MessagingException

setContentLanguage

public void setContentLanguage(String[] languages)
                        throws MessagingException
Specified by:
setContentLanguage in interface MimePart
Throws:
MessagingException

setContentMD5

public void setContentMD5(String md5)
                   throws MessagingException
Specified by:
setContentMD5 in interface MimePart
Throws:
MessagingException

setDataHandler

public void setDataHandler(javax.activation.DataHandler handler)
                    throws MessagingException
Specified by:
setDataHandler in interface Part
Throws:
MessagingException

setDescription

public void setDescription(String description)
                    throws MessagingException
Specified by:
setDescription in interface Part
Throws:
MessagingException

setDescription

public void setDescription(String description,
                           String charset)
                    throws MessagingException
Throws:
MessagingException

setDisposition

public void setDisposition(String disposition)
                    throws MessagingException
Specified by:
setDisposition in interface Part
Throws:
MessagingException

setFileName

public void setFileName(String name)
                 throws MessagingException
Specified by:
setFileName in interface Part
Throws:
MessagingException

setFlags

public void setFlags(Flags flags,
                     boolean set)
              throws MessagingException
Specified by:
setFlags in class Message
Throws:
MessagingException

setFrom

public void setFrom()
             throws MessagingException
Specified by:
setFrom in class Message
Throws:
MessagingException

setFrom

public void setFrom(Address address)
             throws MessagingException
Specified by:
setFrom in class Message
Throws:
MessagingException

setHeader

public void setHeader(String name,
                      String value)
               throws MessagingException
Specified by:
setHeader in interface Part
Throws:
MessagingException

setRecipients

public void setRecipients(Message.RecipientType type,
                          Address[] address)
                   throws MessagingException
Specified by:
setRecipients in class Message
Throws:
MessagingException

setRecipients

public void setRecipients(Message.RecipientType type,
                          String address)
                   throws MessagingException
Throws:
MessagingException

setReplyTo

public void setReplyTo(Address[] address)
                throws MessagingException
Overrides:
setReplyTo in class Message
Throws:
MessagingException

setSentDate

public void setSentDate(Date sent)
                 throws MessagingException
Specified by:
setSentDate in class Message
Throws:
MessagingException

setSubject

public void setSubject(String subject)
                throws MessagingException
Specified by:
setSubject in class Message
Throws:
MessagingException

setSubject

public void setSubject(String subject,
                       String charset)
                throws MessagingException
Throws:
MessagingException

setText

public void setText(String text)
             throws MessagingException
Specified by:
setText in interface MimePart
Throws:
MessagingException

setText

public void setText(String text,
                    String charset)
             throws MessagingException
Specified by:
setText in interface MimePart
Throws:
MessagingException

updateHeaders

protected void updateHeaders()
                      throws MessagingException
Throws:
MessagingException

writeTo

public void writeTo(OutputStream out)
             throws IOException
Specified by:
writeTo in interface Part
Throws:
IOException

writeTo

public void writeTo(OutputStream out,
                    String[] ignoreHeaders)
             throws IOException
Throws:
IOException

setSender

public void setSender(Address address)


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.