[
https://issues.apache.org/jira/browse/MIME4J-65?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615816#action_12615816
]
Stefano Bagnara commented on MIME4J-65:
---------------------------------------
Are you talking about alternative implementations of the Text/Binary body that
could avoid decoding/reencoding when no one ask for the decoded or for a
differently encoded version?
At the moment the specific behaviour we have in the TempFile*Body classes could
be replicated in the Entity.writeTo, but we would need anyway a fix for the
message/rfc822 body parts.
e.g:
private void writeToFile(Body b, File mime4jFile)
throws FileNotFoundException, IOException {
if (b instanceof TextBody) {
String charset =
CharsetUtil.toJavaCharset(b.getParent().getCharset());
if (charset == null) {
charset = "ISO8859-1";
}
OutputStream out = new FileOutputStream(mime4jFile);
IOUtils.copy(((TextBody) b).getReader(), out, charset);
} else {
OutputStream out = new FileOutputStream(mime4jFile);
IOUtils.copy(((BinaryBody) b).getInputStream(), out);
}
}
So for TextBody and BinaryBody we could replicate something similar to get the
stream (clone the IOUtils method to deal with Reader, create a
ReaderInputStream and so on) but we need a solution for the message/rfc822
(instanceof Message) case, first.
Is creating OutputStreams for QP and Base64 the only solution? Any alternative
ideas?
> Message.writeTo for an rfc822 part ignoring a "base64" encoding
> ---------------------------------------------------------------
>
> Key: MIME4J-65
> URL: https://issues.apache.org/jira/browse/MIME4J-65
> Project: Mime4j
> Issue Type: Bug
> Affects Versions: 0.4
> Reporter: Stefano Bagnara
> Fix For: 0.4, 0.5
>
> Attachments: MIME4J-65.patch, testmsgs-message-rfc822-encoding.zip
>
>
> the writeTo method for a Content-Transfer-Encoding: base64 and Content-Type:
> message/rfc822 part writes the message unencoded.
> I would expect it to be encoded in a base64 stream. See MIME4J-64 for an
> useful test.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]