You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Julius Davies <ju...@gmail.com> on 2008/06/03 17:55:00 UTC

Re: [codec] Base64InputStream

Just to let people know:  I'm writing a new Base64InputStream by using
the ws-commons-util logic, but rearranging things to suit this kind of
usage pattern:


#1. in = new Base64InputStream(in, DECODE);

#2. in = new Base64InputStream(in, ENCODE);


The ws-commons-util logic is really slick.  I really like it.  (And
it's so fast).   This is a fun challenge.  I'll post to the list in a
week or two with any progress.


yours,

Julius




On Sat, May 31, 2008 at 11:52 AM, Julius Davies <ju...@gmail.com> wrote:
> Hi, Jochen,
>
>
> Thanks for pointing out that method.  I was looking for a static
> method.  I didn't expect it to be an instance method!  Anyway, now
> that I've found it, ws-commons-util is the winner!
>
>
> [16.203 seconds] ws-commons-util   THE WINNER!!!!
>
> [21.946 seconds] not-yet-commons-ssl
>
>
> (For some reason not-yet-commons-ssl starting running faster....
> weird.  But sun, iharder, and openssl didn't change!)
>
>
> Here's how I used ws-commons-util:
>
>        FileInputStream fi = new FileInputStream(args[0]);
>        InputStream in = new BufferedInputStream(fi);
>        InputStreamReader reader = new InputStreamReader(in, "US-ASCII");
>        char[] buf = new char[8192];
>        Base64 b64 = new Base64();
>        Writer w = b64.newDecoder(out);
>
>        long start = System.currentTimeMillis();
>        int c = reader.read(buf);
>        while (c >= 0) {
>            if (c > 0) {
>                w.write(buf, 0, c);
>            }
>            c = reader.read(buf);
>        }
>        long duration = System.currentTimeMillis() - start;
>
>
> yours,
>
> Julius
>
>
> On Sat, May 31, 2008 at 1:18 AM, Jochen Wiedmann
> <jo...@gmail.com> wrote:
>> On Sat, May 31, 2008 at 9:06 AM, Julius Davies <ju...@gmail.com> wrote:
>>
>>> I also tried to test with ws-common, but the Base64 library in there
>>> doesn't have a streaming decoder, so I don't think it can handle a
>>> 700MB file.
>>
>> And what do you think that
>>
>>    http://ws.apache.org/commons/util/apidocs/org/apache/ws/commons/util/Base64.html#newDecoder(java.io.OutputStream)
>>
>> is? For performance tuning, increasing the underlying buffer might be important.
>>
>> Jochen
>>
>>


-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org