GMemoryInputStream

GMemoryInputStream — Streaming input operations on memory chunks

Synopsis


#include <gio.h>


                    GMemoryInputStream;
GInputStream*       g_memory_input_stream_from_data     (const void *data,
                                                         gssize len);
void                g_memory_input_stream_set_free_data (GMemoryInputStream *stream,
                                                         gboolean free_data);
const void*         g_memory_input_stream_get_data      (GMemoryInputStream *stream);
gsize               g_memory_input_stream_get_data_size (GMemoryInputStream *stream);


Object Hierarchy


  GObject
   +----GInputStream
         +----GMemoryInputStream

Implemented Interfaces

GMemoryInputStream implements GSeekable.

Description

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

Details

GMemoryInputStream

typedef struct _GMemoryInputStream GMemoryInputStream;

Implements GInputStream for arbitrary memory chunks.


g_memory_input_stream_from_data ()

GInputStream*       g_memory_input_stream_from_data     (const void *data,
                                                         gssize len);

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

data :

input data.

len :

length of the data.

Returns :

new GInputStream read from data of len bytes.

g_memory_input_stream_set_free_data ()

void                g_memory_input_stream_set_free_data (GMemoryInputStream *stream,
                                                         gboolean free_data);

Sets if the data within the stream should be freed when the stream is freed.

stream :

a GMemoryInputStream.

free_data :

a gboolean. If TRUE, frees the data within stream.

g_memory_input_stream_get_data ()

const void*         g_memory_input_stream_get_data      (GMemoryInputStream *stream);

Gets a pointer to the data within the GMemoryInputStream.

stream :

a GMemoryInputStream

Returns :

a pointer to the memory in the stream.

g_memory_input_stream_get_data_size ()

gsize               g_memory_input_stream_get_data_size (GMemoryInputStream *stream);

Gets the size of the data within the GMemoryInputStream.

stream :

a GMemoryInputStream

Returns :

a gsize with the size of the data in stream.

See Also

GMemoryOutputStream