com.openexchange.mail.mime
Class ManagedMimeMessage

java.lang.Object
  extended by javax.mail.Message
      extended by javax.mail.internet.MimeMessage
          extended by com.openexchange.mail.mime.ManagedMimeMessage
All Implemented Interfaces:
javax.mail.internet.MimePart, javax.mail.Part

public final class ManagedMimeMessage
extends javax.mail.internet.MimeMessage

ManagedMimeMessage - A MimeMessage backed by an array or file dependent on provided byte array's size.

Invoke cleanUp() to release used resources immediately; otherwise they will be released if a specific idle time has elapsed.

Author:
Thorben Betten

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
javax.mail.internet.MimeMessage.RecipientType
 
Field Summary
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
ManagedMimeMessage(javax.mail.Session session, byte[] sourceBytes)
          Initializes a new ManagedMimeMessage with default in-memory size of 128KB.
ManagedMimeMessage(javax.mail.Session session, byte[] sourceBytes, int maxInMemorySize)
          Initializes a new ManagedMimeMessage.
 
Method Summary
 void cleanUp()
          Cleans up this managed MIME message.
 
Methods inherited from class javax.mail.internet.MimeMessage
addFrom, addHeader, addHeaderLine, addRecipients, addRecipients, getAllHeaderLines, getAllHeaders, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getMessageID, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSize, getSubject, isMimeType, isSet, removeHeader, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, writeTo, writeTo
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setFlag, setRecipient
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedMimeMessage

public ManagedMimeMessage(javax.mail.Session session,
                          byte[] sourceBytes)
                   throws javax.mail.MessagingException,
                          java.io.IOException
Initializes a new ManagedMimeMessage with default in-memory size of 128KB.

Parameters:
session - The session
sourceBytes - The RFC822 source bytes
Throws:
javax.mail.MessagingException - If a messaging error occurs
java.io.IOException - If an I/O error occurs

ManagedMimeMessage

public ManagedMimeMessage(javax.mail.Session session,
                          byte[] sourceBytes,
                          int maxInMemorySize)
                   throws javax.mail.MessagingException,
                          java.io.IOException
Initializes a new ManagedMimeMessage.

Parameters:
session - The session
sourceBytes - The RFC822 source bytes
maxInMemorySize - The max. in-memory size in bytes
Throws:
javax.mail.MessagingException - If a messaging error occurs
java.io.IOException - If an I/O error occurs
Method Detail

cleanUp

public void cleanUp()
             throws javax.mail.MessagingException
Cleans up this managed MIME message.

Throws:
javax.mail.MessagingException - If a messaging error occurs