com.openexchange.mail.structure.handler
Class MIMEStructureHandler

java.lang.Object
  extended by com.openexchange.mail.structure.handler.MIMEStructureHandler
All Implemented Interfaces:
StructureHandler

public final class MIMEStructureHandler
extends java.lang.Object
implements StructureHandler

MIMEStructureHandler - The handler to generate a JSON object reflecting a message's MIME structure.

Author:
Thorben Betten

Constructor Summary
MIMEStructureHandler(long maxSize)
          Initializes a new MIMEStructureHandler.
 
Method Summary
 org.json.JSONObject getJSONMailObject()
          Gets the JSON representation of mail's MIME structure.
 boolean handleAttachment(MailPart part, java.lang.String id)
           
 boolean handleColorLabel(int colorLabel)
           
 boolean handleHeaders(java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)
           
 boolean handleInlineUUEncodedAttachment(UUEncodedPart part, java.lang.String id)
           
 boolean handleInlineUUEncodedPlainText(java.lang.String decodedTextContent, ContentType contentType, int size, java.lang.String fileName, java.lang.String id)
           
 boolean handleMultipartEnd()
           
 boolean handleMultipartStart(ContentType contentType, int bodyPartCount, java.lang.String id)
           
 boolean handleNestedMessage(MailPart mailPart, java.lang.String id)
           
 boolean handleReceivedDate(java.util.Date receivedDate)
           
 boolean handleSystemFlags(int flags)
           
 boolean handleUserFlags(java.lang.String[] userFlags)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIMEStructureHandler

public MIMEStructureHandler(long maxSize)
Initializes a new MIMEStructureHandler.

Parameters:
maxSize - The max. size of a mail part to let its content being inserted as base64 encoded or UTF-8 string.
Method Detail

getJSONMailObject

public org.json.JSONObject getJSONMailObject()
Gets the JSON representation of mail's MIME structure.

Returns:
The JSON representation of mail's MIME structure

handleAttachment

public boolean handleAttachment(MailPart part,
                                java.lang.String id)
                         throws MailException
Specified by:
handleAttachment in interface StructureHandler
Throws:
MailException

handleColorLabel

public boolean handleColorLabel(int colorLabel)
                         throws MailException
Specified by:
handleColorLabel in interface StructureHandler
Throws:
MailException

handleHeaders

public boolean handleHeaders(java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)
                      throws MailException
Specified by:
handleHeaders in interface StructureHandler
Throws:
MailException

handleInlineUUEncodedAttachment

public boolean handleInlineUUEncodedAttachment(UUEncodedPart part,
                                               java.lang.String id)
                                        throws MailException
Specified by:
handleInlineUUEncodedAttachment in interface StructureHandler
Throws:
MailException

handleInlineUUEncodedPlainText

public boolean handleInlineUUEncodedPlainText(java.lang.String decodedTextContent,
                                              ContentType contentType,
                                              int size,
                                              java.lang.String fileName,
                                              java.lang.String id)
                                       throws MailException
Specified by:
handleInlineUUEncodedPlainText in interface StructureHandler
Throws:
MailException

handleMultipartStart

public boolean handleMultipartStart(ContentType contentType,
                                    int bodyPartCount,
                                    java.lang.String id)
                             throws MailException
Specified by:
handleMultipartStart in interface StructureHandler
Throws:
MailException

handleMultipartEnd

public boolean handleMultipartEnd()
                           throws MailException
Specified by:
handleMultipartEnd in interface StructureHandler
Throws:
MailException

handleNestedMessage

public boolean handleNestedMessage(MailPart mailPart,
                                   java.lang.String id)
                            throws MailException
Specified by:
handleNestedMessage in interface StructureHandler
Throws:
MailException

handleReceivedDate

public boolean handleReceivedDate(java.util.Date receivedDate)
                           throws MailException
Specified by:
handleReceivedDate in interface StructureHandler
Throws:
MailException

handleSystemFlags

public boolean handleSystemFlags(int flags)
                          throws MailException
Specified by:
handleSystemFlags in interface StructureHandler
Throws:
MailException

handleUserFlags

public boolean handleUserFlags(java.lang.String[] userFlags)
                        throws MailException
Specified by:
handleUserFlags in interface StructureHandler
Throws:
MailException