Boost logo

Boost Users :

From: David Xiao (davihigh_at_[hidden])
Date: 2006-01-06 10:33:56


Hi Friends:

I am looking for a piece of code which can: input a .zip file name and provide a
callback facility which allow me walking in file structure, as well as survive
from corrupted zip file.

I had read the example code and test code of zlib part in boost::iostreams, it
extract data like this:

//-- copy from iostreams/filter/test.hpp --//
template<typename OutputFilter, typename InputFilter>
bool test_filter_pair( OutputFilter out,
                       InputFilter in,
                       const std::string& data,
                       mpl::true_ )
{
    for ( int inc = default_increment;
          inc <= default_increment * 40;
          inc += default_increment )
    {
        array_source src(data.data(), data.data() + data.size());
        std::string temp;
        std::string dest;
        iostreams::copy(src, compose(out, non_blocking_sink(temp, inc)));
        iostreams::copy(
            compose(in, non_blocking_source(temp, inc)),
            iostreams::back_inserter(dest)
        );
        if (dest != data)
            return false;
    }
    return true;
}

I think it is not gentle because it try catch all data into memory. So there
must be some better way to do?

Rgds, David Xiao


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net