Camel Reference Manual: CamelStreamMem

## CamelStreamMem CamelStreamMem |

## Functions

CamelStream * | camel_stream_mem_new ()
CamelStream * | camel_stream_mem_new_with_byte_array ()
CamelStream * | camel_stream_mem_new_with_buffer ()
void | camel_stream_mem_set_secure ()
GByteArray * | camel_stream_mem_get_byte_array ()
void | camel_stream_mem_set_byte_array ()
void | camel_stream_mem_set_buffer ()

## Types and Values

struct | CamelStreamMem

## Object Hierarchy

        GObject
        ╰── CamelStream
            ╰── CamelStreamMem

## Implemented Interfaces

CamelStreamMem implements GSeekable.

## Description

## Functions

### 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.

#### Parameters

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 gchar *buffer,
                                      gsize 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.

#### Parameters

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 finalized. This only applies to buffers owned by the stream.

#### Parameters

mem | a CamelStreamMem object |

### camel_stream_mem_get_byte_array ()

    GByteArray *
    camel_stream_mem_get_byte_array (CamelStreamMem *mem);

#### Parameters

mem | a CamelStreamMem |

Since 2.32

### 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` .

#### Parameters

mem | a CamelStreamMem object |
buffer | a GByteArray |

### camel_stream_mem_set_buffer ()

    void
    camel_stream_mem_set_buffer (CamelStreamMem *mem,
                                 const gchar *buffer,
                                 gsize 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.

#### Parameters

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

## Types and Values

### struct CamelStreamMem

    struct CamelStreamMem;