A convinience class to write data into an OutputStream. More...
#include <Stream.hh>
Public Member Functions | |
StreamWriter () | |
Constructs a writer with no underlying stream. | |
StreamWriter (OutputStream &out) | |
Constructs a new writer with the given underlying stream. | |
void | reset (OutputStream &os) |
Replaces the current underlying stream with a new one. | |
void | write (uint8_t c) |
Writes a single byte. | |
void | writeBytes (const uint8_t *b, size_t n) |
Writes the specified number of bytes starting at b . | |
void | flush () |
backs up upto the currently written data and flushes the underlying stream. | |
void | more () |
Gets more space to write to. | |
Public Attributes | |
OutputStream * | out_ |
The underlying output stream for this writer. | |
uint8_t * | next_ |
The next location to write to. | |
uint8_t * | end_ |
One past the last location one can write to. |
A convinience class to write data into an OutputStream.
void avro::StreamWriter::more | ( | ) | [inline] |
Gets more space to write to.
Throws an exception it cannot.
References end_, avro::OutputStream::next(), next_, and out_.
Referenced by write(), and writeBytes().
void avro::StreamWriter::reset | ( | OutputStream & | os | ) | [inline] |
Replaces the current underlying stream with a new one.
If required, it backs up unused bytes in the previous stream.
References avro::OutputStream::backup(), end_, next_, and out_.
Referenced by StreamWriter().