2

How can I use boost::iostreams::gzip_decompressor to decompress a sequence of boost::asio::streambuf's?

Here is what I had in mind (non-working pseudo code):

struct Foo {
public:
    void sinkData(boost::asio::streambuf & buf) {
        z.write(boost::asio::buffer_cast<const char*>(buf.data()), buf.size());
        while(write());
    }

    void flush() {
        z.flush();
        while(write());
    }

private:
    bool write() {
        char buf[1024];
        size_t s = z.read(buf, 1024);
        std::cout << std::string(buf, s) << std::endl;
        return 
    }

    gzip_decompressor z;
}

The sinkData and the flush functions can not be changed. sinkdata() is called a number of time, followed by a single call to flush().

Is boost::iostreams::gzip_decompressor the best library for this purpose, if so how to do it? Otherwise, what could else be suggested?

Allan
  • 4,562
  • 8
  • 38
  • 59

0 Answers0