## CamelStreamMem CamelStreamMem |

## Synopsis

    struct              CamelStreamMem;
    CamelStream *       camel_stream_mem_new                (void);
    CamelStream *       camel_stream_mem_new_with_byte_array
                                                            (GByteArray *buffer);
    CamelStream *       camel_stream_mem_new_with_buffer    (const char *buffer,
                                                             size_t len);
    void                camel_stream_mem_set_secure         (CamelStreamMem *mem);
    void                camel_stream_mem_set_byte_array     (CamelStreamMem *mem,
                                                             GByteArray *buffer);
    void                camel_stream_mem_set_buffer         (CamelStreamMem *mem,
                                                             const char *buffer,
                                                             size_t len);

## Description

## Details

### struct CamelStreamMem

    struct CamelStreamMem {
    	CamelSeekableStream parent_object;

    	unsigned int owner:1;	/* do we own the buffer? */
    	unsigned int secure:1;	/* do we clear the buffer on finalise (if we own it) */
    	GByteArray *buffer;
    };

### camel_stream_mem_new ()

    CamelStream *       camel_stream_mem_new                (void);

Create a new CamelStreamMem object.

Returns : | a new CamelStreamMem

### camel_stream_mem_new_with_byte_array ()

    CamelStream *       camel_stream_mem_new_with_byte_array
                                                            (GByteArray *buffer);

Create a new CamelStreamMem using `buffer` as the stream data.

Note: The newly created CamelStreamMem will destroy `buffer` when destroyed.

`buffer` : | a GByteArray to use as the stream data
Returns : | a new CamelStreamMem

### camel_stream_mem_new_with_buffer ()

    CamelStream *       camel_stream_mem_new_with_buffer    (const char *buffer,
                                                             size_t len);

Create a new memory stream using `buffer` as the stream data.

Note: `buffer` will be copied into an internal GByteArray structure for use as the stream backing. This may have resource implications you may wish to consider.

`buffer` : | a memory buffer to use as the stream data
`len` : | length of `buffer`
Returns : | a new CamelStreamMem

### camel_stream_mem_set_secure ()

    void                camel_stream_mem_set_secure         (CamelStreamMem *mem);

Mark the memory stream as secure. At the very least this means the data in the buffer will be cleared when the buffer is finalised. This only applies to buffers owned by the stream.

`mem` : | a CamelStreamMem object

### camel_stream_mem_set_byte_array ()

    void                camel_stream_mem_set_byte_array     (CamelStreamMem *mem,
                                                             GByteArray *buffer);

Set `buffer` to be the backing data to the existing CamelStreamMem, `mem`.

Note: `mem` will not take ownership of `buffer` and so will need to be freed separately from `mem`.

`mem` : | a CamelStreamMem object
`buffer` : | a GByteArray

### camel_stream_mem_set_buffer ()

    void                camel_stream_mem_set_buffer         (CamelStreamMem *mem,
                                                             const char *buffer,
                                                             size_t len);

Set `buffer` to be the backing data to the existing CamelStreamMem, `mem`.

Note: `buffer` will be copied into an internal GByteArray structure and so may have resource implications to consider.

`mem` : | a CamelStreamMem object
`buffer` : | a memory buffer
`len` : | length of `buffer`