GMimeStreamMem

## GMimeStreamMem GMimeStreamMem — A memory-backed stream |

## Synopsis

                        GMimeStreamMem;
    GMimeStream *       g_mime_stream_mem_new               (void);
    GMimeStream *       g_mime_stream_mem_new_with_byte_array
                                                            (GByteArray *array);
    GMimeStream *       g_mime_stream_mem_new_with_buffer   (const char *buffer,
                                                             size_t len);
    GByteArray *        g_mime_stream_mem_get_byte_array    (GMimeStreamMem *mem);
    void                g_mime_stream_mem_set_byte_array    (GMimeStreamMem *mem,
                                                             GByteArray *array);
    gboolean            g_mime_stream_mem_get_owner         (GMimeStreamMem *mem);
    void                g_mime_stream_mem_set_owner         (GMimeStreamMem *mem,
                                                             gboolean owner);

## Object Hierarchy

      GObject
       +----GMimeStream
             +----GMimeStreamMem

## Description

A simple GMimeStream implementation that uses a memory buffer for storage.

## Details

### GMimeStreamMem

    typedef struct _GMimeStreamMem GMimeStreamMem;

### g_mime_stream_mem_new ()

    GMimeStream *       g_mime_stream_mem_new               (void);

Creates a new GMimeStreamMem object.

Returns : | a new memory stream.

### g_mime_stream_mem_new_with_byte_array ()

    GMimeStream *       g_mime_stream_mem_new_with_byte_array
                                                            (GByteArray *array);

Creates a new GMimeStreamMem with data `array`.

`array` : | source data
Returns : | a new memory stream using `array`.

### g_mime_stream_mem_new_with_buffer ()

    GMimeStream *       g_mime_stream_mem_new_with_buffer   (const char *buffer,
                                                             size_t len);

Creates a new GMimeStreamMem object and initializes the stream contents with the first `len` bytes of `buffer`.

`buffer` : | stream data
`len` : | data length
Returns : | a new memory stream initialized with `buffer`.

### g_mime_stream_mem_get_byte_array ()

    GByteArray *        g_mime_stream_mem_get_byte_array    (GMimeStreamMem *mem);

Gets the byte array from the memory stream.

`mem` : | memory stream
Returns : | the byte array from the memory stream.

### g_mime_stream_mem_set_byte_array ()

    void                g_mime_stream_mem_set_byte_array    (GMimeStreamMem *mem,
                                                             GByteArray *array);

Sets the byte array on the memory stream.

Note: The memory stream is not responsible for freeing the byte array.

`mem` : | memory stream
`array` : | stream data

### g_mime_stream_mem_get_owner ()

    gboolean            g_mime_stream_mem_get_owner         (GMimeStreamMem *mem);

Gets whether or not `mem` owns the backend memory buffer.

`mem` : | memory stream
Returns : | %TRUE if `mem` owns the backend memory buffer or `FALSE` otherwise.

### g_mime_stream_mem_set_owner ()

    void                g_mime_stream_mem_set_owner         (GMimeStreamMem *mem,
                                                             gboolean owner);

Sets whether or not `mem` owns the backend memory buffer.

Note: `owner` should be `TRUE` if the stream should free the backend memory buffer when destroyed or `FALSE` otherwise.

`mem` : | memory stream
`owner` : | owner

## See Also

#GMimeStream