[ 
https://issues.apache.org/jira/browse/MIME4J-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616177#action_12616177
 ] 

Stefano Bagnara commented on MIME4J-67:
---------------------------------------

I started trying to use your encoder stuff but I saw I was loosing too much 
time trying to solve this base64 issue, so I decided to reuse code. This is why 
I love opensource.

About the performance see MIME4J-65 comments. About the verbosity it's a matter 
of style. I'm +1 in using anything more performant and less verbose as long as 
the bug is fixed too.

I don't say that I don't like the current approach. In fact I like it, but it 
has issues and I had no time to waste on fixing procedures that already exists 
and works.

Please note that the outputstream class I introduced on top of the 
QuotedPrintableEncoder does not change anything in the real byte flow: I simply 
exposed your code/methods through a standard OutputStream interface. If you 
missed it please just look at the patch again.
I would have done the same for the Base64Encoder but I found this issue and 
after 10 minutes I had not a solution for this, so I decided to use the first 
ASF licensed Base64OutputStream class I found. 5 minutes later I had a working 
implementation. I didn't look back at all.

Please note that if you have a fast fix for the Base64Encoder issues (this one 
and the MIME4J-66) then my approach to fix MIME4J-65 should work like a charm 
(reproducing the QuotedPrintableOutputStream pattern for the Base64 stuff) and 
without loosing performance at all.

Again, I never said I don't like the Encoder you wrote. They are cool and it 
seems you even wrote the only cool QuotedPrintable encoder supporting advanced 
rules. You did such a good job (really, this is not ironic) that I'm sure you 
are able to decide what to do with my patches without any need for me to push 
anything.


> Base64Encoder fails to encode streams longer than its buffer size (1024)
> ------------------------------------------------------------------------
>
>                 Key: MIME4J-67
>                 URL: https://issues.apache.org/jira/browse/MIME4J-67
>             Project: Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.4
>            Reporter: Stefano Bagnara
>             Fix For: 0.4
>
>
> When encoding streams longer than 1024 bytes the encoder simply concatenate 
> the base64 version of each 1024 chunk and this is wrong. Base64 streams are 
> only concatenable when the original text length was a multiple of 3. 
> Supporting buffer chunks encoding require keeping the last 1-2 bytes in a 
> buffer and eventually convert them to base64 ending sequences only when the 
> stream is closed.

-- 
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]

Reply via email to