MemoryInputStream#

class MemoryInputStream(**properties: Any)#

Superclasses: InputStream, Object

Implemented Interfaces: 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#

class MemoryInputStream
classmethod new() InputStream#

Creates a new empty MemoryInputStream.

classmethod new_from_bytes(bytes: Bytes) InputStream#

Creates a new MemoryInputStream with data from the given bytes.

Added in version 2.34.

Parameters:

bytes – a Bytes

classmethod new_from_data(data: Sequence[int], destroy: Callable[[None], None] | None = 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#

class MemoryInputStream
add_bytes(bytes: Bytes) None#

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

Added in version 2.34.

Parameters:

bytes – input data

add_data(data: Sequence[int], destroy: Callable[[None], None] | None = 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

Fields#

class MemoryInputStream
parent_instance#
priv#