![]() |
![]() |
![]() |
GIO Reference Manual | ![]() |
---|---|---|---|---|
#include <gio.h> GMemoryOutputStream; GOutputStream* g_memory_output_stream_new (GByteArray *data); void g_memory_output_stream_set_max_size (GMemoryOutputStream *ostream, guint max_size); GByteArray* g_memory_output_stream_get_data (GMemoryOutputStream *ostream); void g_memory_output_stream_set_free_data (GMemoryOutputStream *ostream, gboolean free_data);
"data" gpointer : Read / Write / Construct "free-array" gboolean : Read / Write "size-limit" guint : Read / Write
GMemoryOutputStream is a class for using arbitrary memory chunks as output for GIO streaming output operations.
typedef struct _GMemoryOutputStream GMemoryOutputStream;
Implements GOutputStream for arbitrary memory chunks.
GOutputStream* g_memory_output_stream_new (GByteArray *data);
Creates a new GMemoryOutputStream. If data
is non-NULL
it will use
that for its internal storage otherwise it will create a new GByteArray.
In both cases the internal GByteArray can later be accessed through the
"data" property, or with g_memory_output_stream_get_data()
.
Note: The new stream will not take ownership of the supplied
data
so you have to free it yourself after use or explicitly
ask for it be freed on close by setting the "free-array"
property to TRUE
.
|
a GByteArray. |
Returns : |
A newly created GMemoryOutputStream object. |
void g_memory_output_stream_set_max_size (GMemoryOutputStream *ostream, guint max_size);
Sets a size limit on the data contained within the output stream.
|
a GMemoryOutputStream. |
|
a guint to set as the maximum stream size. |
GByteArray* g_memory_output_stream_get_data (GMemoryOutputStream *ostream);
Gets any loaded data from the ostream
.
|
a GMemoryOutputStream |
Returns : |
GByteArray of the stream's data. |
void g_memory_output_stream_set_free_data (GMemoryOutputStream *ostream, gboolean free_data);
Sets if the data within the stream
should be freed when the stream
is freed.
|
a GMemoryOutputStream. |
|
a gboolean. If TRUE , frees the data within stream .
|