org.apache.geronimo.javamail.store.imap
Class IMAPMimeBodyPart

java.lang.Object
  extended by javax.mail.BodyPart
      extended by javax.mail.internet.MimeBodyPart
          extended by org.apache.geronimo.javamail.store.imap.IMAPMimeBodyPart
All Implemented Interfaces:
MimePart, Part

public class IMAPMimeBodyPart
extends MimeBodyPart


Field Summary
protected  IMAPBodyStructure bodyStructure
           
protected  IMAPMessage message
           
protected  String section
           
 
Fields inherited from class javax.mail.internet.MimeBodyPart
content, contentStream, dh, headers
 
Fields inherited from class javax.mail.BodyPart
parent
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
IMAPMimeBodyPart(IMAPMessage message, IMAPBodyStructure bodyStructure, String section)
          Create an instance of a MimeBodyPart within an IMAP message.
 
Method Summary
 void addHeader(String name, String value)
           
 void addHeaderLine(String line)
           
 Enumeration getAllHeaderLines()
           
 Enumeration getAllHeaders()
           
 String getContentID()
           
 String getContentMD5()
           
protected  InputStream getContentStream()
           
 String getContentType()
          Get the content type for the body part.
 DataHandler getDataHandler()
          Create the DataHandler object for this message.
 String getDescription()
           
 String getDisposition()
          Retrieve the disposition information about this body part.
 String getEncoding()
           
 String getFileName()
           
 String[] getHeader(String name)
          Following is a set of methods that deal with headers These methods are just overrides on the superclass methods to allow lazy loading of the header information.
 String getHeader(String name, String delimiter)
           
 int getLineCount()
          Get the estimated line count for the body part.
 Enumeration getMatchingHeaderLines(String[] names)
           
 Enumeration getMatchingHeaders(String[] names)
           
 Enumeration getNonMatchingHeaderLines(String[] names)
           
 Enumeration getNonMatchingHeaders(String[] names)
           
 int getSize()
          Get the size of the message part.
 boolean isMimeType(String type)
          Test if the body part is of a particular MIME type.
protected  void loadContent()
          Load the message content into the BodyPart object.
protected  void loadHeaders()
          Load the mime part headers into this body part.
 void removeHeader(String name)
           
 void setContent(Multipart mp)
           
 void setContent(Object o, String type)
           
 void setContentID(String id)
           
 void setContentMD5(String id)
           
 void setDataHandler(DataHandler content)
           
 void setDescription(String d, String charset)
           
 void setDisposition(String disposition)
          Set the disposition information.
 void setFileName(String name)
           
 void setHeader(String name, String value)
           
 
Methods inherited from class javax.mail.internet.MimeBodyPart
attachFile, attachFile, getContent, getContentLanguage, getInputStream, getRawInputStream, saveFile, saveFile, setContentLanguage, setDescription, setText, setText, setText, updateHeaders, writeTo
 
Methods inherited from class javax.mail.BodyPart
getParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message

protected IMAPMessage message

bodyStructure

protected IMAPBodyStructure bodyStructure

section

protected String section
Constructor Detail

IMAPMimeBodyPart

public IMAPMimeBodyPart(IMAPMessage message,
                        IMAPBodyStructure bodyStructure,
                        String section)
Create an instance of a MimeBodyPart within an IMAP message.

Parameters:
message - The parent Message instance containing this part.
bodyStructure - The IMAPBodyStructure information describing the part.
section - The numeric section identifier string for this part. This is a hierarchical set of numbers describing how to navigate to the message part on the IMAP server. For example, "2.1.3" would be the third subpart of the first subpart of the second main message part.
Method Detail

getSize

public int getSize()
            throws MessagingException
Get the size of the message part.

Specified by:
getSize in interface Part
Overrides:
getSize in class MimeBodyPart
Returns:
The size information returned in the IMAP body structure.
Throws:
MessagingException

getLineCount

public int getLineCount()
                 throws MessagingException
Get the estimated line count for the body part.

Specified by:
getLineCount in interface Part
Overrides:
getLineCount in class MimeBodyPart
Returns:
The line count information returned by the IMAP server.
Throws:
MessagingException

getContentType

public String getContentType()
                      throws MessagingException
Get the content type for the body part.

Specified by:
getContentType in interface Part
Overrides:
getContentType in class MimeBodyPart
Returns:
The mimetype for the body part, in string format.
Throws:
MessagingException

isMimeType

public boolean isMimeType(String type)
                   throws MessagingException
Test if the body part is of a particular MIME type.

Specified by:
isMimeType in interface Part
Overrides:
isMimeType in class MimeBodyPart
Parameters:
type - The string MIME-type name. A wild card * can be specified for the subpart type.
Returns:
true if the body part matches the give MIME-type.
Throws:
MessagingException

getDisposition

public String getDisposition()
                      throws MessagingException
Retrieve the disposition information about this body part.

Specified by:
getDisposition in interface Part
Overrides:
getDisposition in class MimeBodyPart
Returns:
The disposition information, as a string value.
Throws:
MessagingException

setDisposition

public void setDisposition(String disposition)
                    throws MessagingException
Set the disposition information. The IMAP message is read-only, so this is an error.

Specified by:
setDisposition in interface Part
Overrides:
setDisposition in class MimeBodyPart
Parameters:
disposition - The disposition string.
Throws:
MessagingException

getEncoding

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

getContentID

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

setContentID

public void setContentID(String id)
                  throws MessagingException
Overrides:
setContentID in class MimeBodyPart
Throws:
MessagingException

getContentMD5

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

setContentMD5

public void setContentMD5(String id)
                   throws MessagingException
Specified by:
setContentMD5 in interface MimePart
Overrides:
setContentMD5 in class MimeBodyPart
Throws:
MessagingException

getDescription

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

setDescription

public void setDescription(String d,
                           String charset)
                    throws MessagingException
Overrides:
setDescription in class MimeBodyPart
Throws:
MessagingException

getFileName

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

setFileName

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

getContentStream

protected InputStream getContentStream()
                                throws MessagingException
Overrides:
getContentStream in class MimeBodyPart
Throws:
MessagingException

getDataHandler

public DataHandler getDataHandler()
                           throws MessagingException
Create the DataHandler object for this message.

Specified by:
getDataHandler in interface Part
Overrides:
getDataHandler in class MimeBodyPart
Returns:
The DataHandler object that processes the content set for this message.
Throws:
MessagingException

setDataHandler

public void setDataHandler(DataHandler content)
                    throws MessagingException
Specified by:
setDataHandler in interface Part
Overrides:
setDataHandler in class MimeBodyPart
Throws:
MessagingException

setContent

public void setContent(Object o,
                       String type)
                throws MessagingException
Specified by:
setContent in interface Part
Overrides:
setContent in class MimeBodyPart
Throws:
MessagingException

setContent

public void setContent(Multipart mp)
                throws MessagingException
Specified by:
setContent in interface Part
Overrides:
setContent in class MimeBodyPart
Throws:
MessagingException

getHeader

public String[] getHeader(String name)
                   throws MessagingException
Following is a set of methods that deal with headers These methods are just overrides on the superclass methods to allow lazy loading of the header information.

Specified by:
getHeader in interface Part
Overrides:
getHeader in class MimeBodyPart
Throws:
MessagingException

getHeader

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

getAllHeaders

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

getMatchingHeaders

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

getNonMatchingHeaders

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

getAllHeaderLines

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

getMatchingHeaderLines

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

getNonMatchingHeaderLines

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

addHeader

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

setHeader

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

removeHeader

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

addHeaderLine

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

loadHeaders

protected void loadHeaders()
                    throws MessagingException
Load the mime part headers into this body part.

Throws:
MessagingException

loadContent

protected void loadContent()
                    throws MessagingException
Load the message content into the BodyPart object.

Throws:
MessagingException


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