org.apache.james.core
Class MimeMessageUtil

java.lang.Object
  extended byorg.apache.james.core.MimeMessageUtil

public class MimeMessageUtil
extends Object

Utility class to provide optimized write methods for the various MimeMessage implementations.


Constructor Summary
MimeMessageUtil()
           
 
Method Summary
static long calculateMessageSize(MimeMessage message)
           
static void copyStream(InputStream in, OutputStream out)
          Convenience method to copy streams
static InputStream getHeadersInputStream(MimeMessage message, String[] ignoreList)
           
static long getMessageSize(MimeMessage message)
           
static void writeHeadersTo(Enumeration headers, OutputStream headerOs)
          Write the message headers to the given outputstream
static void writeMessageBodyTo(MimeMessage message, OutputStream bodyOs)
           
static void writeTo(MimeMessage message, OutputStream headerOs, OutputStream bodyOs)
          Convenience method to take any MimeMessage and write the headers and body to two different output streams
static void writeTo(MimeMessage message, OutputStream headerOs, OutputStream bodyOs, String[] ignoreList)
          Convenience method to take any MimeMessage and write the headers and body to two different output streams, with an ignore list
static void writeToInternal(MimeMessage message, OutputStream headerOs, OutputStream bodyOs, String[] ignoreList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeMessageUtil

public MimeMessageUtil()
Method Detail

writeTo

public static void writeTo(MimeMessage message,
                           OutputStream headerOs,
                           OutputStream bodyOs)
                    throws IOException,
                           MessagingException
Convenience method to take any MimeMessage and write the headers and body to two different output streams

Throws:
IOException
MessagingException

writeTo

public static void writeTo(MimeMessage message,
                           OutputStream headerOs,
                           OutputStream bodyOs,
                           String[] ignoreList)
                    throws IOException,
                           MessagingException
Convenience method to take any MimeMessage and write the headers and body to two different output streams, with an ignore list

Throws:
IOException
MessagingException

writeToInternal

public static void writeToInternal(MimeMessage message,
                                   OutputStream headerOs,
                                   OutputStream bodyOs,
                                   String[] ignoreList)
                            throws MessagingException,
                                   IOException,
                                   UnsupportedDataTypeException
Parameters:
message -
headerOs -
bodyOs -
ignoreList -
Throws:
MessagingException
IOException
UnsupportedDataTypeException

writeMessageBodyTo

public static void writeMessageBodyTo(MimeMessage message,
                                      OutputStream bodyOs)
                               throws IOException,
                                      UnsupportedDataTypeException,
                                      MessagingException
Throws:
IOException
UnsupportedDataTypeException
MessagingException

copyStream

public static void copyStream(InputStream in,
                              OutputStream out)
                       throws IOException
Convenience method to copy streams

Throws:
IOException

writeHeadersTo

public static void writeHeadersTo(Enumeration headers,
                                  OutputStream headerOs)
                           throws MessagingException
Write the message headers to the given outputstream

Parameters:
headerOs -
Throws:
MessagingException

getHeadersInputStream

public static InputStream getHeadersInputStream(MimeMessage message,
                                                String[] ignoreList)
                                         throws MessagingException
Parameters:
message -
ignoreList -
Returns:
Throws:
MessagingException

getMessageSize

public static long getMessageSize(MimeMessage message)
                           throws MessagingException
Returns:
size of full message including headers
Throws:
MessagingException - if a problem occours while computing the message size

calculateMessageSize

public static long calculateMessageSize(MimeMessage message)
                                 throws MessagingException
Parameters:
message -
Returns:
the calculated size
Throws:
MessagingException


"Copyright © 1999-2006 Apache Jakarta Project. All Rights Reserved."