5 #include <boost/iostreams/filtering_streambuf.hpp>
6 #include <boost/iostreams/copy.hpp>
7 #include <boost/iostreams/filter/gzip.hpp>
20 static std::string
Compress(
const std::string& data)
22 namespace bio = boost::iostreams;
24 std::stringstream compressed;
25 std::stringstream origin(data);
27 bio::filtering_streambuf<bio::input> out;
28 out.push(bio::gzip_compressor(bio::gzip_params(bio::gzip::best_compression)));
30 bio::copy(out, compressed);
32 return compressed.str();
42 namespace bio = boost::iostreams;
44 std::stringstream compressed(data);
45 std::stringstream decompressed;
47 bio::filtering_streambuf<bio::input> out;
48 out.push(bio::gzip_decompressor());
50 bio::copy(out, decompressed);
52 return decompressed.str();
static std::string Decompress(const std::string &data)
Decompresses provided data.
Definition: GZip.h:40
Utility to gzip strings.
Definition: GZip.h:13
static std::string Compress(const std::string &data)
Compresses provided data.
Definition: GZip.h:20