Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-10-04 08:59:06


On Fri, 03 Oct 2003 17:53:28 +0200, Jonathan de Halleux wrote
> I have implement iostream wrappers around the zlib and bzip2
> compression library. I emphasize that the zlib wrapper does not rely
> on gz methods and therefore it is not limited to file->buffer or
> buffer->file operation.
>
> A simple example of the stream is as follows:
>
> ostream& output; // suppose this reference is initialized
>
> {
> zip_ostream zipper( output ); // creating a zipper on top of output
> // zipper behaves as any ostream
> zipper<<"hello";
> ...
> } // when closed, the zipper is flushed.
>
> That's it. Basically, these wrapper makes it very easy to add
> compression to existing applications. Any suggestions welcome :)
>
> The demo application is in the yahoo files section, at
>
http://f4.grp.yahoofs.com/v1/8I59P2nge463UXu3tTedwKzeExG8x4XegRqG4Q1Ovvt7RkgQba70tS6udf6RXviGTf1-UeE9HUE5Df2T-z6qgQdOEAlQ5os7UJTdtg/zipstream_demo.zip
You can also have a look at an article that explains deeper zipstreams at
http://www.codeproject.com/vcpp/stl/zipstream.asp

Johnathan -

Very interesting. I wrote one of these a couple years ago, so you might want
to have a look.

http://groups.yahoo.com/group/boost/files/compressed_streams/

Reading thru your article it looks like we have similar approaches: adapt the
stream buf to use zlib for compression. Your implementation is nice since it
supports all stream types while I was focused on file types.

Anyway, I would love to see something like this go into boost and I certainly
don't have the time to do it...

One problem you will face is the question whether it is appropriate for a
boost library to require another library (excluding the standard library) to
use. There was some discussion of this on the list a couple years back when I
posted my library. As I recall, I think people were leaning towards saying it
was ok -- especially given that zlib has been ported all over.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk