40 if (fullName ==
"/dev/null") {
46 throw IOError(
TLF(
"Could not redirect to NUL device (%).", std::string(std::strerror(errno))));
52 std::ios_base::openmode mode = std::ios_base::out;
54 mode |= std::ios_base::binary;
57 if (fullName.length() > 3 && fullName.substr(fullName.length() - 3) ==
".gz") {
61 throw IOError(
"Could not build output file '" + fullName +
"' (" + e.
what() +
").");
63 throw IOError(
"Could not build output file '" + fullName +
"' (" + e.
what() +
").");
70 myFileStream =
new std::ofstream(localName.c_str(), mode);
74 throw IOError(
"Could not build output file '" + fullName +
"' (" + std::strerror(errno) +
").");
bool myAmNull
am I redirecting to /dev/null
std::ostream * myFileStream
The wrapped ofstream.
OutputDevice_File(const std::string &fullName, const bool binary=false)
Constructor.
~OutputDevice_File()
Destructor.
Static storage of an output device and its base (abstract) implementation.
OutputFormatter * myFormatter
The formatter for XML, CSV or Parquet.
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
Exception class thrown by failed operations.
const char * what() const noexcept
Exception class thrown by failed zlib operations.
#define UNUSED_PARAMETER(x)