diff --git a/modules/io/src/mol/star_writer.cc b/modules/io/src/mol/star_writer.cc index 1a017e934d9778d06732661c1feffa3d7562f696..b06270bb8cd2f75c0a75a71107d45fd49be8fa6d 100644 --- a/modules/io/src/mol/star_writer.cc +++ b/modules/io/src/mol/star_writer.cc @@ -17,6 +17,10 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //------------------------------------------------------------------------------ +#include <boost/iostreams/filter/gzip.hpp> +#include <boost/algorithm/string/predicate.hpp> +#include <boost/filesystem.hpp> + #include <ost/io/mol/star_writer.hh> namespace ost{ namespace io{ @@ -40,6 +44,9 @@ StarWriter::StarWriter(const String& filename): filename_(filename), << strerror(errno) << std::endl; throw IOException(ss.str()); } + if (boost::iequals(".gz", boost::filesystem::extension(filename))) { + stream_.push(boost::iostreams::gzip_compressor()); + } stream_.push(fstream_); }