commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Davies" <juliusdav...@gmail.com>
Subject Re: [codec] Base64InputStream
Date Mon, 16 Jun 2008 15:44:18 GMT
Hi,

Base64InputStream and Base64OutputStream are coming along.  They both
have JUnit tests now:

Source:
http://juliusdavies.ca/codec/src/java/org/apache/commons/codec/binary/

JUnit:
http://juliusdavies.ca/codec/src/test/org/apache/commons/codec/binary/


I still need to do some more javadocs before I attach a patch to the
JIRA ticket.   Right now the JUnits test byte-by-byte operation of the
streams (e.g. int i = in.read()), so I'd like to also introduce
chunk-by-chunk JUnit tests as well.


This was a fun test!  (Wrap the InputStream over and over and over
again with decoding then encoding then decoding...).

InputStream in = new ByteArrayInputStream(data);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);
in = new Base64InputStream(in, true);
in = new Base64InputStream(in, false);






yours,

Julius


On Tue, Jun 10, 2008 at 3:30 AM, sebb <sebbaz@gmail.com> wrote:
> On 10/06/2008, Julius Davies <juliusdavies@gmail.com> wrote:
>> Hi,
>>
>>
>>  Here's what a streaming version of Base64 looks like (without javadocs).
>>
>>  http://juliusdavies.ca/codec/src/java/org/apache/commons/codec/binary/Base64.java
>>
>
> Just curious - why use a byte for the chunk size?
> I would have thought an int would be more usual (possibly accompanied
> by a range check).
> Likewise modulus - using an int would avoid a few casts.
>
> Or maybe these are from the original code.
>
> http://juliusdavies.ca/codec/src/java/org/apache/commons/codec/binary/Base64InputStream.java
>>
>>
>>  I'll submit a proper patch once I have the javadocs and streaming
>>  junits put together.
>>
>>  Note:  all the pre-existing Base64 unit tests are passing!  (They were
>>  very helpful).
>>
>>
>>  Thanks to Jochen Wiedmann for pointing out the base64 streaming code
>>  in ws-commons-util that this is based on.
>>
>>
>>
>>  --
>>  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
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>



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


Mime
View raw message