On 02/17/2013 12:13 AM, Thad Humphries wrote:
> I am using Commons Codec v1.7 to Base64 encode a TIFF file for writing to
> an XML file as CDATA. Simple:
>
> File file = new File(fileName);
> FileInputStream fis = new FileInputStream(file);
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> Base64OutputStream b64os = new Base64OutputStream(baos);
> int bufSize = 8 * 1024;
> byte [] buffer = new byte[bufSize];
> int count;
> while ((count = fis.read(buffer, 0, bufSize)) != -1)
> b64os.write(buffer, 0, count);
> fis.close();
> baos.flush();
> b64os.close();
> baos.close();
> xtw.writeCData(new String(baos.toByteArray()));
>
> However I'm concerned that a future version Commons Codec of might not
> default to chunked output. So I'd like to swap
>
> Base64OutputStream b64os = new Base64OutputStream(baos);
>
> for
>
> byte [] eol = {0xD, 0xA};
> Base64OutputStream b64os = new Base64OutputStream(baos, true, 76,
> eol);
>
> However when I do this, the program crashes out on creating "new
> Base64OutputStream(...)". If fact, it skips right past a catch on Exception
> and goes directly to finally (honest--my logger shows nothing and I've
> watched this dozens of times in Eclipse's deugger).
>
> Am I doing something wrong?
Hi Thad,
I just tried your example and this works pretty fine for me. Could you
please post the exception you are getting?
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]