1#ifndef BYTEME_OSTREAM_WRITER_HPP
2#define BYTEME_OSTREAM_WRITER_HPP
23template<
class Po
inter_ = std::ostream*>
34 void write(
const unsigned char* buffer,
size_t n) {
35 my_output->write(
reinterpret_cast<const char*
>(buffer), n);
36 if (!(my_output->good())) {
37 throw std::runtime_error(
"failed to write to arbitrary output stream");
43 if (my_output->fail() || my_output->bad()) {
44 throw std::runtime_error(
"failed to flush to arbitrary output stream");
Read bytes from a std::ostream.
Definition OstreamWriter.hpp:24
OstreamWriter(Pointer_ output)
Definition OstreamWriter.hpp:30
void finish()
Definition OstreamWriter.hpp:41
void write(const unsigned char *buffer, size_t n)
Definition OstreamWriter.hpp:34
Virtual class for writing bytes to a sink.
Definition Writer.hpp:18
virtual void write(const unsigned char *buffer, size_t n)=0
Simple byte readers and writers.