GMemoryInputStream

GMemoryInputStream — Streaming input operations on memory chunks

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GInputStream
        ╰── GMemoryInputStream

Implemented Interfaces

GMemoryInputStream implements GSeekable and GPollableInputStream.

Includes

#include <gio/gio.h>

Description

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

As of GLib 2.34, GMemoryInputStream implements GPollableInputStream.

Functions

g_memory_input_stream_new ()

GInputStream *
g_memory_input_stream_new (void);

Creates a new empty GMemoryInputStream.

Returns

a new GInputStream


g_memory_input_stream_new_from_data ()

GInputStream *
g_memory_input_stream_new_from_data (const void *data,
                                     gssize len,
                                     GDestroyNotify destroy);

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

Parameters

data

input data.

[array length=len][element-type guint8][transfer full]

len

length of the data, may be -1 if data is a nul-terminated string

 

destroy

function that is called to free data , or NULL.

[allow-none]

Returns

new GInputStream read from data of len bytes.


g_memory_input_stream_new_from_bytes ()

GInputStream *
g_memory_input_stream_new_from_bytes (GBytes *bytes);

Creates a new GMemoryInputStream with data from the given bytes .

Parameters

bytes

a GBytes

 

Returns

new GInputStream read from bytes

Since: 2.34


g_memory_input_stream_add_data ()

void
g_memory_input_stream_add_data (GMemoryInputStream *stream,
                                const void *data,
                                gssize len,
                                GDestroyNotify destroy);

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

Parameters

stream

a GMemoryInputStream

 

data

input data.

[array length=len][element-type guint8][transfer full]

len

length of the data, may be -1 if data is a nul-terminated string

 

destroy

function that is called to free data , or NULL.

[allow-none]

g_memory_input_stream_add_bytes ()

void
g_memory_input_stream_add_bytes (GMemoryInputStream *stream,
                                 GBytes *bytes);

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

Parameters

stream

a GMemoryInputStream

 

bytes

input data

 

Since: 2.34

Types and Values

GMemoryInputStream

typedef struct _GMemoryInputStream GMemoryInputStream;

Implements GInputStream for arbitrary memory chunks.

See Also

GMemoryOutputStream