Class DefaultMessageWriter
java.lang.Object
org.apache.james.mime4j.message.DefaultMessageWriter
- All Implemented Interfaces:
MessageWriter
Default implementation of
MessageWriter.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]protected OutputStreamencodeStream(OutputStream out, String encoding, boolean binaryBody) private ByteSequencegetBoundary(ContentTypeField contentType) private ContentTypeFieldgetContentType(Multipart multipart) voidwriteBody(Body body, OutputStream out) Write the specifiedBodyto the specifiedOutputStream.private voidwriteBytes(ByteSequence byteSequence, OutputStream out) 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.
-
Field Details
-
CRLF
private static final byte[] CRLF -
DASHES
private static final byte[] DASHES
-
-
Constructor Details
-
DefaultMessageWriter
public DefaultMessageWriter()Protected constructor prevents direct instantiation.
-
-
Method Details
-
asBytes
- Throws:
IOException
-
writeBody
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
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
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
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
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
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
-
getContentType
-
getBoundary
-
writeBytes
- Throws:
IOException
-