gio.MemoryOutputStream

gio.MemoryOutputStream — Streaming output operations on memory chunks

Synopsis

class gio.MemoryOutputStream(gio.OutputStream):
    gio.MemoryOutputStream()
def get_contents()
def get_data_size()
def get_size()

Ancestry

+-- gobject.GObject
  +-- gio.OutputStream
    +-- gio.MemoryOutputStream

Implemented Interfaces

gio.MemoryOutputStream implements gio.Seekable

Description

gio.MemoryOutputStream is a class for using arbitrary memory chunks as output for GIO streaming output operations.

Constructor

    gio.MemoryOutputStream()

Returns :

a new gio.MemoryOutputStream.

Creates a new gio.MemoryOutputStream.

Methods

gio.MemoryOutputStream.get_contents

    def get_contents()

Returns :

the stream's data

The get_contents() method gets any loaded data from the ostream.

Note that the returned data may become invalid on the next write or truncate operation on the stream.

gio.MemoryOutputStream.get_data_size

    def get_data_size()

Returns :

the number of bytes written to the stream

The get_data_size() method returns the number of bytes from the start up to including the last byte written in the stream that has not been truncated away.

gio.MemoryOutputStream.get_size

    def get_size()

Returns :

the number of bytes allocated for the data buffer

The get_size() method gets the size of the currently allocated data area (availible from gio.MemoryOutputStream.get_contents() ).

Note that for growable streams the returned size may become invalid on the next write or truncate operation on the stream.

If you want the number of bytes currently written to the stream, use gio.MemoryOutputStream.get_data_size().