ark::core::ByteBufferStreamBuf

Defined in header “ark/core/streambuf.hh”.


This class forms a streambuf that writes directly to a byte buffer, which can potentially save a few memory copies when using APIs that prefer istream/ostream.

This is not a complete implementation of a streambuf, but wraps typical use cases.

Methods

  • ByteBufferStreamBuf(core::ByteBuffer & target)
    Constructor. Wraps the given byte buffer. You maintain ownership of the buffer.

  • std::streamsize xsgetn(char * s, std::streamsize n)
    Called when AWS is reading characters from the buffer.

  • pos_type seekoff(off_type offset, std::ios_base::seekdir dir, std::ios_base::openmode which)
    This is invoked when someone calls tellp() or tellg() it also allows the caller to seek the input stream to a particular location.

    This is a partial implementation right now, and only supports some seeking features.

  • int underflow()
    Returns the current character that is under the input cursor, or eof() if at the end of the stream.

  • int uflow()
    Returns the current character that is under the input cursor, and advances the cursor forward by one location. Returns eof if already at the end of the stream.

  • std::streamsize xsputn(const char * s, std::streamsize n)
    Called when AWS is writing characters to the buffer.

  • int overflow(int c)
    Called when AWS is writing a single character to the buffer.