mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-27 03:49:57 +03:00
zipped output file
This commit is contained in:
parent
ebc33f63e9
commit
1b04b5544b
@ -49,9 +49,11 @@ OutputFileStream::~OutputFileStream()
|
||||
bool OutputFileStream::Open(const std::string &filePath)
|
||||
{
|
||||
m_outFile = new ofstream(filePath.c_str(), ios_base::out | ios_base::binary);
|
||||
if (m_outFile->fail()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filePath.size() > 3 && filePath.substr(filePath.size() - 3, 3) == ".gz")
|
||||
{
|
||||
if (filePath.size() > 3 && filePath.substr(filePath.size() - 3, 3) == ".gz") {
|
||||
this->push(boost::iostreams::gzip_compressor());
|
||||
m_isGZ = true;
|
||||
}
|
||||
@ -67,14 +69,12 @@ void OutputFileStream::Close()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_isGZ) {
|
||||
this->pop();
|
||||
}
|
||||
this->pop(); // file
|
||||
|
||||
//this->close();
|
||||
m_outFile->close();
|
||||
delete m_outFile;
|
||||
m_outFile = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
OutputFileStream();
|
||||
|
||||
OutputFileStream(const std::string &filePath);
|
||||
~OutputFileStream();
|
||||
virtual ~OutputFileStream();
|
||||
|
||||
bool Open(const std::string &filePath);
|
||||
void Close();
|
||||
|
Loading…
Reference in New Issue
Block a user