commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [CODEC] Base64 vs. sun.misc.BASE64Decode
Date Sat, 19 Aug 2006 20:39:26 GMT
Selon Chris Hane <>:

>       BufferedWriter out = new BufferedWriter(new FileWriter(new
> File("c:\\var\\test.pdf")));

I think this is the same problem. The Writer class hierarchy is devoted to
characters handling. It is often used as an upper layer on bytes oriented
streams. This layer induces another encoding somewhere. Since you already have
the bytes produced by the Base 64 decoder, just put thes bytes to your pdf file
using any classes from the OutputStream class hierarchy.

You could even get rid of your loop and remove the buffering class by following
this simple example:

   FileOutputStream fos = new FileOutputStream("c:\\var\\test.pdf");
   fos.flush();  // not sure this is useful as we will close soon


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message