|
Boost Users : |
Subject: Re: [Boost-users] [bzip2 iostreams] [serialization] How to serialize an object into a bzip2 file and vice versa.
From: Roland Bock (rbock_at_[hidden])
Date: 2009-09-11 13:31:32
Sebastian Korf wrote:
> int main()
> {
> using namespace std;
> using namespace boost::iostreams;
> ifstream file("E:\\test.txt.bz2", ios_base::in | ios_base::binary);
> filtering_streambuf<input> in;
> in.push(bzip2_decompressor());
> in.push(file);
> ofstream fileOutput("E:\\test2.text");
> copy(in,fileOutput);
> }
>
> But if i try to decompress a file which i serialized, bzip just runs
> forever doing nothing.
There are several open tickets which deal with (de-)compression with
iostreams.
I had problems with zip, bzip and istreams myself. I found that ostreams
work where istreams don't:
https://svn.boost.org/trac/boost/ticket/2411
Unfortunately, with gzip decompression, ostreams sometimes fail but
istreams work:
https://svn.boost.org/trac/boost/ticket/2415
An infinite loop also has been reported before (in case of invalid input)
https://svn.boost.org/trac/boost/ticket/2783
I also wrote a test program some time ago to determine the best
compression method for my purposes, see attachment.
HTH
Regards,
Roland
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net