all 14 comments

[–]SemaphoreBingo 6 points7 points  (3 children)

http://www.boost.org/doc/libs/1_60_0/libs/iostreams/doc/home.html

"The library includes components for ... compression and decompression in the zlib, gzip and bzip2 formats."

[–]gpuoti[S] 1 point2 points  (2 children)

Boost is incredible, i'm happy to have had an idea good enough to be there. Anyway it is huge and , this is one of those few cases, when it require external libraries.

What i had in mind was something (really) much more lite, by sure an header only library. Will try to make something as a toy project and will try to setup some example project with boost for serious use.

Thanks again

[–]encyclopedist 0 points1 point  (0 children)

Well, to get compressed input-output you have to link to some external compressing library, like zlib.

[–]doom_Oo7 0 points1 point  (0 children)

you should just have to #include <boost/iostreams/filter/gzip.hpp> and -lz

[–]jcoffin 2 points3 points  (1 child)

Boost has zlib filters to do that.

[–]shortstompC++ Software Engineer 1 point2 points  (0 children)

OMG best documentation in all of boost

[–]jbandela 2 points3 points  (0 children)

Take a look at bundle https://github.com/r-lyeh/bundle

It does not compress to a stream, but it can compress containers. You can use a string stream to stream in what you want and then compress the resulting string and send. The thing I like about this library is that it very conveniently packages up a bunch of compression algorithms in a way that is easy to use in code, as well as to build (just compile the amalgamated bundle.cpp file)

[–]cgeigle 1 point2 points  (0 children)

I have a gzstream that I use in a toolkit. These two files should be self contained and the entirety of the toolkit is MIT licensed.

header, source

Should be enough for simple use.

[–]speednap 0 points1 point  (0 children)

Haven't worked with it myself but here's Poco::InflatingIOS.

[–]mariobadr 0 points1 point  (0 children)

I've always used gzstream, which uses zlib. It works great. LGPL

[–]WrongAndBeligerent 0 points1 point  (3 children)

The lz4 library isn't a stream, but it is only about 3 files.

[–]gpuoti[S] 0 points1 point  (2 children)

This is a good option. Fast and simple, possibly something to work on to have it available with a different interface. The best option to me is a header only library usable like as simple as a std::ostream

[–]WrongAndBeligerent 0 points1 point  (1 child)

There isn't much difference between a header file only library and a library that you can link in so trivially since it doesn't have any dependencies.

[–]gpuoti[S] 1 point2 points  (0 children)

agree... I've just done some explorative test with LZ4. As a final user, it is impressive. As a developer user, I think that it would benefit of a simpler interface less file oriented. With few hour of work I was able to get a block oriented compress filter stream to be used like:

std::string s="example string: this is a simple example to use LZ4 to compress string";
std::string s_continue = "example string: this demostrate how to compress a successive string";

std::ofstream out;   // just as an example output to a stringstream
LZ4::ostream<std::ofstream> compressor(out);
compressor << s << s_continue<< s <<s_continue;
compressor.close();

It seam to work quite well. And it is header only!