Avro C++
Public Member Functions | Public Attributes | List of all members
avro::StreamWriter Struct Reference

A convenience 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. More...
 
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.
 
int64_t byteCount () const
 Return the number of bytes written so far. More...
 
void more ()
 Gets more space to write to. More...
 

Public Attributes

OutputStreamout_
 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.
 

Detailed Description

A convenience class to write data into an OutputStream.

Member Function Documentation

◆ byteCount()

int64_t avro::StreamWriter::byteCount ( ) const
inline

Return the number of bytes written so far.

For a meaningful result, call this after a flush().

References avro::OutputStream::byteCount(), and out_.

◆ more()

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().

◆ reset()

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().


The documentation for this struct was generated from the following file: