I have a vector that contains zlib-compressed (deflated) data. I would like to decompress it with Boost's filtering_istream
. There is only one example on their site, which operates on a stream of data (as opposed to a vector that I have).
vector<char> compressed_buffer;
compressed_buffer.resize(cdh.length);
file.read(&compressed_buffer[0], cdh.length);
filtering_istream in;
in.push(zlib_decompressor());
in.push(something(compressed_data)); // what should "something" be?
I would like to get the uncompressed data as a vector as well. How can I do this?
How about an
array_source
?Then use
boost::iostreams::copy
with astd::insert_iterator
to push the result characters into a new vector.