org.apache.james.mime4j.message
Class MessageWriter

java.lang.Object
  extended by org.apache.james.mime4j.message.MessageWriter

public class MessageWriter
extends java.lang.Object

Writes a message (or a part of a message) to an output stream.

This class cannot be instantiated; instead the static instance DEFAULT implements the default strategy for writing a message.

This class may be subclassed to implement custom strategies for writing messages.


Field Summary
static MessageWriter DEFAULT
          The default message writer.
 
Constructor Summary
protected MessageWriter()
          Protected constructor prevents direct instantiation.
 
Method Summary
protected  java.io.OutputStream encodeStream(java.io.OutputStream out, java.lang.String encoding, boolean binaryBody)
           
 void writeBody(Body body, java.io.OutputStream out)
          Write the specified Body to the specified OutputStream.
 void writeEntity(Entity entity, java.io.OutputStream out)
          Write the specified Entity to the specified OutputStream.
 void writeHeader(Header header, java.io.OutputStream out)
          Write the specified Header to the specified OutputStream.
 void writeMultipart(Multipart multipart, java.io.OutputStream out)
          Write the specified Multipart to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final MessageWriter DEFAULT
The default message writer.

Constructor Detail

MessageWriter

protected MessageWriter()
Protected constructor prevents direct instantiation.

Method Detail

writeBody

public void writeBody(Body body,
                      java.io.OutputStream out)
               throws java.io.IOException
Write the specified Body to the specified OutputStream.

Parameters:
body - the Body to write.
out - the OutputStream to write to.
Throws:
java.io.IOException - if an I/O error occurs.

writeEntity

public void writeEntity(Entity entity,
                        java.io.OutputStream out)
                 throws java.io.IOException
Write the specified Entity to the specified OutputStream.

Parameters:
entity - the Entity to write.
out - the OutputStream to write to.
Throws:
java.io.IOException - if an I/O error occurs.

writeMultipart

public void writeMultipart(Multipart multipart,
                           java.io.OutputStream out)
                    throws java.io.IOException
Write the specified Multipart to the specified OutputStream.

Parameters:
multipart - the Multipart to write.
out - the OutputStream to write to.
Throws:
java.io.IOException - if an I/O error occurs.

writeHeader

public void writeHeader(Header header,
                        java.io.OutputStream out)
                 throws java.io.IOException
Write the specified Header to the specified OutputStream.

Parameters:
header - the Header to write.
out - the OutputStream to write to.
Throws:
java.io.IOException - if an I/O error occurs.

encodeStream

protected java.io.OutputStream encodeStream(java.io.OutputStream out,
                                            java.lang.String encoding,
                                            boolean binaryBody)
                                     throws java.io.IOException
Throws:
java.io.IOException


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