Skip to content

Gio.MemoryInputStream

class — extends InputStream, PollableInputStream, Seekable

GMemoryInputStream is a class for using arbitrary memory chunks as input for GIO streaming input operations.

As of GLib 2.34, GMemoryInputStream implements PollableInputStream.

Constructors

new

@classmethod
def new(cls) -> InputStream

Creates a new empty MemoryInputStream.

new_from_bytes

@classmethod
def new_from_bytes(cls, bytes: bytes) -> InputStream

Creates a new MemoryInputStream with data from the given bytes.

Parameters:

new_from_data

@classmethod
def new_from_data(cls, data: list[int], destroy: GLib.DestroyNotify | None = ...) -> InputStream

Creates a new MemoryInputStream with data in memory of a given size.

Parameters:

  • data — input data
  • destroy — function that is called to free data, or None

Methods

add_bytes

def add_bytes(self, bytes: bytes) -> None

Appends bytes to data that can be read from the input stream.

Parameters:

  • bytes — input data

add_data

def add_data(self, data: list[int], destroy: GLib.DestroyNotify | None = ...) -> None

Appends data to data that can be read from the input stream

Parameters:

  • data — input data
  • destroy — function that is called to free data, or None