filtering_streambuf: Compressing a character buffer
Hi, I have a character buffer ( "buffer" ) of known size ( "size_in_bytes" ), and would like to compress it using gzip_compressor and then get a pointer to the compressed buffer along with the compressed size. I've put together the following, but it says the first counter is 0 and the second counter is 2. Any help that can be offered is appreciated. namespace io = boost::iostreams; boost::asio::streambuf sb; std::ostream os(&sb); os.write( buffer, size_in_bytes ); io::filtering_streambufboost::iostreams::output out; out.push(io::counter()); out.push(io::gzip_compressor()); out.push(io::counter()); out.push(os); io::close(out); // Needed for flushing the data from compressor std::ostream output(&out); // Maybe I can use rdbuf() to get the pointer to the stream?
participants (1)
-
Adlai Shawareb