GMemoryOutputStream

GMemoryOutputStream

Synopsis




                    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_on_close
                                                        (GMemoryOutputStream *ostream,
                                                         gboolean free_on_close);


Object Hierarchy


  GObject
   +----GOutputStream
         +----GMemoryOutputStream

Implemented Interfaces

GMemoryOutputStream implements GSeekable.

Properties


  "data"                     gpointer              : Read / Write / Construct
  "free-array"               gboolean              : Read / Write
  "size-limit"               guint                 : Read / Write

Description

Details

GMemoryOutputStream

typedef struct _GMemoryOutputStream GMemoryOutputStream;


g_memory_output_stream_new ()

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.

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.

data :

a GByteArray.

Returns :

A newly created GMemoryOutputStream object.

g_memory_output_stream_set_max_size ()

void                g_memory_output_stream_set_max_size (GMemoryOutputStream *ostream,
                                                         guint max_size);

ostream :

max_size :


g_memory_output_stream_get_data ()

GByteArray*         g_memory_output_stream_get_data     (GMemoryOutputStream *ostream);

ostream :

Returns :

GByteArray of the stream's data.

g_memory_output_stream_set_free_on_close ()

void                g_memory_output_stream_set_free_on_close
                                                        (GMemoryOutputStream *ostream,
                                                         gboolean free_on_close);

ostream :

free_on_close :

Property Details

The "data" property

  "data"                     gpointer              : Read / Write / Construct

The byte array used as internal storage.


The "free-array" property

  "free-array"               gboolean              : Read / Write

Wether or not the interal array should be free on close.

Default value: FALSE


The "size-limit" property

  "size-limit"               guint                 : Read / Write

Maximum amount of bytes that can be written to the stream.

Default value: 0