Package org.apache.james.mime4j.message
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 OutputStream
encodeStream
(OutputStream out, String encoding, boolean binaryBody) private ByteSequence
getBoundary
(ContentTypeField contentType) private ContentTypeField
getContentType
(Multipart multipart) void
writeBody
(Body body, OutputStream out) Write the specifiedBody
to the specifiedOutputStream
.private void
writeBytes
(ByteSequence byteSequence, OutputStream out) void
writeEntity
(Entity entity, OutputStream out) Write the specifiedEntity
to the specifiedOutputStream
.void
writeField
(Field field, OutputStream out) Write the specifiedField
to the specifiedOutputStream
.void
writeHeader
(Header header, OutputStream out) Write the specifiedHeader
to the specifiedOutputStream
.void
writeMessage
(Message message, OutputStream out) Write the specifiedMessage
to the specifiedOutputStream
.void
writeMultipart
(Multipart multipart, OutputStream out) Write the specifiedMultipart
to 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 specifiedBody
to the specifiedOutputStream
.- Specified by:
writeBody
in interfaceMessageWriter
- Parameters:
body
- theBody
to write.out
- the OutputStream to write to.- Throws:
IOException
- if an I/O error occurs.
-
writeEntity
Write the specifiedEntity
to the specifiedOutputStream
.- Specified by:
writeEntity
in interfaceMessageWriter
- Parameters:
entity
- theEntity
to write.out
- the OutputStream to write to.- Throws:
IOException
- if an I/O error occurs.
-
writeMessage
Write the specifiedMessage
to the specifiedOutputStream
.- Specified by:
writeMessage
in interfaceMessageWriter
- Parameters:
message
- theMessage
to write.out
- the OutputStream to write to.- Throws:
IOException
- if an I/O error occurs.
-
writeMultipart
Write the specifiedMultipart
to the specifiedOutputStream
.- Specified by:
writeMultipart
in interfaceMessageWriter
- Parameters:
multipart
- theMultipart
to write.out
- the OutputStream to write to.- Throws:
IOException
- if an I/O error occurs.
-
writeField
Write the specifiedField
to the specifiedOutputStream
.- Specified by:
writeField
in interfaceMessageWriter
- Parameters:
field
- theField
to write.out
- the OutputStream to write to.- Throws:
IOException
- if an I/O error occurs.
-
writeHeader
Write the specifiedHeader
to the specifiedOutputStream
.- Specified by:
writeHeader
in interfaceMessageWriter
- Parameters:
header
- theHeader
to 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
-