a std::ostream with good error messages, and which does fsync on close on UNIX. More...
#include <Streams.hpp>
Public Member Functions | |
OutputStream (const char *fn) | |
OutputStream (const std::string &fn) | |
void | open (const std::string &fn) |
void | open (const char *fn) |
void | close () |
Static Public Member Functions | |
static boost::shared_ptr < std::ostream > | openCompressedOutputStreamByExtension (const std::string &fn) |
Returns a pointer to an OutputStream or CompressedOutputStream, depending on the file extension. |
a std::ostream with good error messages, and which does fsync on close on UNIX.
Note that calling flush() of this class will not cause fsync(2) call, since FileSinkDevice is not marked as flushable. This is so that we don't fsync on every f << std::endl. If you really need to sync to disk without closing the stream, you can do:
OutputStream f("foo");
f.flush();
(*f).fsync();
This will use operator*() to get access to the underlying device. This class will fsync automatically when closing itself.
static boost::shared_ptr<std::ostream> cgatools::util::OutputStream::openCompressedOutputStreamByExtension | ( | const std::string & | fn | ) | [static] |
Returns a pointer to an OutputStream or CompressedOutputStream, depending on the file extension.
File extensions supported: