我怎样才能DECOM preSS与升压瘪数据的载体? [英] How can I decompress a vector of deflated data with Boost?
问题描述
我有一个包含zlib的-COM pressed(瘪)数据的载体。我想用DECOM Boost的 filtering_istream
preSS它。只有一个在其网站上,其上的数据的一个流上进行操作(而不是一个矢量,我有)的例子。
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?
我想获得uncom pressed数据作为载体为好。我怎样才能做到这一点?
I would like to get the uncompressed data as a vector as well. How can I do this?
推荐答案
怎么样的的 array_source
?
How about an array_source
?
in.push(array_source(&*compressed_data.begin(), &*compressed_data.end()));
然后使用的boost :: iostream的副本::
与的std :: insert_iterator
来的结果字符推入一个新的载体。
Then use boost::iostreams::copy
with a std::insert_iterator
to push the result characters into a new vector.
这篇关于我怎样才能DECOM preSS与升压瘪数据的载体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!