Package org.apache.james.mime4j.message
Class DefaultMessageWriter
- java.lang.Object
-
- org.apache.james.mime4j.message.DefaultMessageWriter
-
- All Implemented Interfaces:
MessageWriter
public class DefaultMessageWriter extends Object implements MessageWriter
Default implementation ofMessageWriter.
-
-
Constructor Summary
Constructors Constructor Description DefaultMessageWriter()Protected constructor prevents direct instantiation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]asBytes(Message message)protected OutputStreamencodeStream(OutputStream out, String encoding, boolean binaryBody)voidwriteBody(Body body, OutputStream out)Write the specifiedBodyto the specifiedOutputStream.voidwriteEntity(Entity entity, OutputStream out)Write the specifiedEntityto the specifiedOutputStream.voidwriteField(Field field, OutputStream out)Write the specifiedFieldto the specifiedOutputStream.voidwriteHeader(Header header, OutputStream out)Write the specifiedHeaderto the specifiedOutputStream.voidwriteMessage(Message message, OutputStream out)Write the specifiedMessageto the specifiedOutputStream.voidwriteMultipart(Multipart multipart, OutputStream out)Write the specifiedMultipartto the specifiedOutputStream.
-
-
-
Method Detail
-
asBytes
public static byte[] asBytes(Message message) throws IOException
- Throws:
IOException
-
writeBody
public void writeBody(Body body, OutputStream out) throws IOException
Write the specifiedBodyto the specifiedOutputStream.- Specified by:
writeBodyin interfaceMessageWriter- Parameters:
body- theBodyto write.out- the OutputStream to write to.- Throws:
IOException- if an I/O error occurs.
-
writeEntity
public void writeEntity(Entity entity, OutputStream out) throws IOException
Write the specifiedEntityto the specifiedOutputStream.- Specified by:
writeEntityin interfaceMessageWriter- Parameters:
entity- theEntityto write.out- the OutputStream to write to.- Throws:
IOException- if an I/O error occurs.
-
writeMessage
public void writeMessage(Message message, OutputStream out) throws IOException
Write the specifiedMessageto the specifiedOutputStream.- Specified by:
writeMessagein interfaceMessageWriter- Parameters:
message- theMessageto write.out- the OutputStream to write to.- Throws:
IOException- if an I/O error occurs.
-
writeMultipart
public void writeMultipart(Multipart multipart, OutputStream out) throws IOException
Write the specifiedMultipartto the specifiedOutputStream.- Specified by:
writeMultipartin interfaceMessageWriter- Parameters:
multipart- theMultipartto write.out- the OutputStream to write to.- Throws:
IOException- if an I/O error occurs.
-
writeField
public void writeField(Field field, OutputStream out) throws IOException
Write the specifiedFieldto the specifiedOutputStream.- Specified by:
writeFieldin interfaceMessageWriter- Parameters:
field- theFieldto write.out- the OutputStream to write to.- Throws:
IOException- if an I/O error occurs.
-
writeHeader
public void writeHeader(Header header, OutputStream out) throws IOException
Write the specifiedHeaderto the specifiedOutputStream.- Specified by:
writeHeaderin interfaceMessageWriter- Parameters:
header- theHeaderto write.out- the OutputStream to write to.- Throws:
IOException- if an I/O error occurs.
-
encodeStream
protected OutputStream encodeStream(OutputStream out, String encoding, boolean binaryBody) throws IOException
- Throws:
IOException
-
-