You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jochen Wiedmann (JIRA)" <ji...@apache.org> on 2011/01/13 09:09:45 UTC

[jira] Resolved: (CODEC-108) Base64 encoding issue for larger avi files

     [ https://issues.apache.org/jira/browse/CODEC-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Wiedmann resolved CODEC-108.
-----------------------------------

    Resolution: Fixed

Your example is one of the ugliest pieces of code that I've ever seen. And yet you believe there is an error in the code you are using ...

Let's start with the fact that you must not use BufferedReader, readLine() etc. for reading AVI files. These are binary files. Hence they must be read through an InputStream, and only an InputStream.

Let's continue with the fact that you are using Base64.encode(byte[]) repeatedly in a loop: That method is supposed to encode a *complete block* all in one go. You can of course use it more than once and concatenate the data, as you do. However, the result of Base64.decode() on the same data will always be the first block only.

As the next thing let us question whether you really should use base64 encoding for files of that size. I am quite certain that there would be better possibilities.

Finally I suggest that you are using Commons Codec 1.4, preferrably the Base64OutputStream, which allows you to read bytes from the input file and write them to an output file as bytes too.

Please, *don't* use this Jira issue for further conversation on your problems. This is the bug tracker and not a support forum. The mailing list commons users is meant for that.





> Base64 encoding issue for larger avi files
> ------------------------------------------
>
>                 Key: CODEC-108
>                 URL: https://issues.apache.org/jira/browse/CODEC-108
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Amit Sharma
>         Attachments: PutServiceSizeTest.java
>
>
> I am using base64.encode/decode for xml files..it works fine with smaller files. But, when i try to encode larger avi files using Base64 encoder..it reduces file size. 
> Could you please tell me, why its happening ??

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.