:right-sidebar: True MemoryOutputStream =================================================================== .. currentmodule:: gi.repository.Gio .. class:: MemoryOutputStream(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gio.OutputStream`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gio.PollableOutputStream`, :class:`~gi.repository.Gio.Seekable` ``GMemoryOutputStream`` is a class for using arbitrary memory chunks as output for GIO streaming output operations. As of GLib 2.34, ``GMemoryOutputStream`` trivially implements :obj:`~gi.repository.Gio.PollableOutputStream`\: it always polls as ready. Constructors ------------ .. rst-class:: interim-class .. class:: MemoryOutputStream :no-index: .. classmethod:: new_resizable() -> ~gi.repository.Gio.OutputStream Creates a new :obj:`~gi.repository.Gio.MemoryOutputStream`\, using :func:`~gi.repository.GLib.realloc` and :func:`~gi.repository.GLib.free` for memory allocation. .. versionadded:: 2.36 Methods ------- .. rst-class:: interim-class .. class:: MemoryOutputStream :no-index: .. method:: get_data() -> ~typing.Any | None Gets any loaded data from the ``ostream``\. Note that the returned pointer may become invalid on the next write or truncate operation on the stream. .. method:: get_data_size() -> int Returns the number of bytes from the start up to including the last byte written in the stream that has not been truncated away. .. versionadded:: 2.18 .. method:: get_size() -> int Gets the size of the currently allocated data area (available from :func:`~gi.repository.Gio.MemoryOutputStream.get_data`). You probably don't want to use this function on resizable streams. See :func:`~gi.repository.Gio.MemoryOutputStream.get_data_size` instead. For resizable streams the size returned by this function is an implementation detail and may be change at any time in response to operations on the stream. If the stream is fixed-sized (ie: no realloc was passed to :func:`~gi.repository.Gio.MemoryOutputStream.new`) then this is the maximum size of the stream and further writes will return :const:`~gi.repository.Gio.IOErrorEnum.NO_SPACE`. In any case, if you want the number of bytes currently written to the stream, use :func:`~gi.repository.Gio.MemoryOutputStream.get_data_size`. Properties ---------- .. rst-class:: interim-class .. class:: MemoryOutputStream :no-index: .. attribute:: props.data :type: ~typing.Any The type of the None singleton. .. versionadded:: 2.24 .. attribute:: props.data_size :type: int The type of the None singleton. .. versionadded:: 2.24 .. attribute:: props.size :type: int The type of the None singleton. .. versionadded:: 2.24 Fields ------ .. rst-class:: interim-class .. class:: MemoryOutputStream :no-index: .. attribute:: parent_instance .. attribute:: priv