Skip to content
Snippets Groups Projects
Commit f791529c authored by Studer Gabriel's avatar Studer Gabriel
Browse files

mmcif writer: automatically apply gzip compression when file ends with ".gz"

parent bca9cd36
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // 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> #include <ost/io/mol/star_writer.hh>
namespace ost{ namespace io{ namespace ost{ namespace io{
...@@ -40,6 +44,9 @@ StarWriter::StarWriter(const String& filename): filename_(filename), ...@@ -40,6 +44,9 @@ StarWriter::StarWriter(const String& filename): filename_(filename),
<< strerror(errno) << std::endl; << strerror(errno) << std::endl;
throw IOException(ss.str()); throw IOException(ss.str());
} }
if (boost::iequals(".gz", boost::filesystem::extension(filename))) {
stream_.push(boost::iostreams::gzip_compressor());
}
stream_.push(fstream_); stream_.push(fstream_);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment