5 #include <boost/iostreams/device/file.hpp> 6 #include <boost/iostreams/filter/gzip.hpp> 7 #include <boost/iostreams/filtering_stream.hpp> 13 boost::iostreams::filtering_ostream& out, std::string
const& filename) {
15 if (filename ==
"stdout") {
20 out.push(boost::iostreams::gzip_compressor());
22 boost::iostreams::file_sink file(
23 filename, std::ios_base::out | std::ios_base::binary);
28 boost::iostreams::filtering_istream& in, std::string
const& filename) {
30 boost::iostreams::file_source file(
31 filename, std::ios_base::in | std::ios_base::binary);
33 in.push(boost::iostreams::gzip_decompressor());
void open_output_file(boost::iostreams::filtering_ostream &out, std::string const &filename)
Open a file for writing.
void open_input_file(boost::iostreams::filtering_istream &in, std::string const &filename)
Open a file for reading.
bool is_gz(std::string const &filename)
Return true if the filename ends in .gz.