commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Priblouda <>
Subject Re: [codec] My own little base64 implementation, as an {Input,Output}Stream.
Date Tue, 04 Nov 2003 09:19:54 GMT

> By which I think you're referring to
> org.xml.sax.ContentHandler? If the 
> contents of an element includes a large blob of
> continuous text, the 
> parsers are free to deliver this to your application
> in little chunks 
> (and in fact do break it into chunks) so as to save
> on the maximum 
> amount of memory the parser might be forced to
> allocate. Theoretically, 
> it is then *your* problem to figure out whether or
> not it is a good idea 
> to bundle all of the data up into a giant String or
> StringBuffer before 
> you process it.

Well, that exactly the problem.... And another proble
is that I have to gather those chunks together ( for
current implementation of base64 ) , and to organize a
tstream out of them which I pass to create BLOB. 
( and they are big... ) 

So content handler delivering a stream of characters
to me ( reader? ) , which I could chain with base64
streaming decoder would save a lot on memory
allocation / deallocation.   And this allocating
busyness is a wrong way - data amounts tend to
explode. And there will be big flash simulations or
PDFs in your knowlege management system... I know
those editors :) 

> Nobody said the SAX API makes life easy. An
> interesting point, at least 
> in the context of this discussion thread, is that
> you'd then need to 
> pass the *characters* off to the base64 decoder, but
> in chunks of a size 
> that the parser chooses, which unfortunately might
> not line up with the 
> four-character chunks that a base64 decoder wants
> Hope that helps.

This problem can be solved though. Current codec
implementation works buffer-buffer  with padding, 
( and is basically stateless )  - streaming will
gobble all up available data, and then just signal an
end when 
padding reached... 

( and of course it has to be able to read off reader
:) ) 


----[ Konstantin Pribluda ( ko5tik ) ]----------------
Zu Verstärkung meines Teams suche ich ab Sofort einen
Softwareentwickler[In] für die Festanstellung. 
Arbeitsort: Mainz 
Skills:  Programieren, Kentnisse in OpenSource-Bereich
----[ ]------------------------

Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

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

View raw message