class StringStream

Bases: iostream

A bi-directional stream object that reads and writes data to an internal buffer, which can be retrieved and/or set as a string in Python 2 or a bytes object in Python 3.

Inheritance diagram

Inheritance diagram of StringStream

StringStream(PyObject *source)

This version of the constructor preloads the buffer with the indicated data.

void clear_data(void)

Empties the buffer.

PyObject *get_data(void)

Returns the contents of the data stream as a string.

std::size_t get_data_size(void)

Returns the number of characters available to be read from the data stream.

void set_data(PyObject *data)

Replaces the contents of the data stream. This implicitly reseeks to 0.