## GMimeDataWrapper GMimeDataWrapper — Content objects |

## Functions

GMimeDataWrapper * | g_mime_data_wrapper_new ()
GMimeDataWrapper * | g_mime_data_wrapper_new_with_stream ()
void | g_mime_data_wrapper_set_stream ()
GMimeStream * | g_mime_data_wrapper_get_stream ()
void | g_mime_data_wrapper_set_encoding ()
GMimeContentEncoding | g_mime_data_wrapper_get_encoding ()
ssize_t | g_mime_data_wrapper_write_to_stream ()

## Types and Values

struct | GMimeDataWrapper

## Object Hierarchy

        GObject
        ╰── GMimeDataWrapper

## Description

A GMimeDataWrapper is a wrapper object for a GMimePart's body, allowing clients to read the content from the backing stream without having to know whether it is encoded/compressed/etc and not neding to know how to undo said encoding(s).

## Functions

### g_mime_data_wrapper_new ()

    GMimeDataWrapper *
    g_mime_data_wrapper_new (void);

Creates a new GMimeDataWrapper object.

#### Returns

a new data wrapper object.

### g_mime_data_wrapper_new_with_stream ()

    GMimeDataWrapper *
    g_mime_data_wrapper_new_with_stream (GMimeStream *stream,
                                         GMimeContentEncoding encoding);

Creates a new GMimeDataWrapper object around `stream` .

#### Parameters

stream | a GMimeStream |
encoding | stream's encoding |

#### Returns

a data wrapper around `stream` . Since the wrapper owns its own reference on the stream, caller is responsible for unrefing its own copy.

### g_mime_data_wrapper_set_stream ()

    void
    g_mime_data_wrapper_set_stream (GMimeDataWrapper *wrapper,
                                    GMimeStream *stream);

Replaces the wrapper's internal stream with `stream` . Don't forget, if `stream` is not of the same encoding as the old stream, you'll want to call `g_mime_data_wrapper_set_encoding()` as well.

Note: caller is responsible for its own reference on `stream` .

#### Parameters

wrapper | a GMimeDataWrapper |
stream | a GMimeStream |

### g_mime_data_wrapper_get_stream ()

    GMimeStream *
    g_mime_data_wrapper_get_stream (GMimeDataWrapper *wrapper);

Gets a reference to the stream wrapped by `wrapper` .

#### Parameters

wrapper | a GMimeDataWrapper |

#### Returns

a reference to the internal stream.

[transfer none]

### g_mime_data_wrapper_set_encoding ()

    void
    g_mime_data_wrapper_set_encoding (GMimeDataWrapper *wrapper,
                                      GMimeContentEncoding encoding);

Sets the encoding type of the internal stream.

#### Parameters

wrapper | a GMimeDataWrapper |
encoding | encoding |

### g_mime_data_wrapper_get_encoding ()

    GMimeContentEncoding
    g_mime_data_wrapper_get_encoding (GMimeDataWrapper *wrapper);

Gets the encoding type of the stream wrapped by `wrapper` .

#### Parameters

wrapper | a GMimeDataWrapper |

#### Returns

the encoding type of the internal stream.

### g_mime_data_wrapper_write_to_stream ()

    ssize_t
    g_mime_data_wrapper_write_to_stream (GMimeDataWrapper *wrapper,
                                         GMimeStream *stream);

Writes the raw (decoded) data to the output stream.

#### Parameters

wrapper | a GMimeDataWrapper |
stream | output stream |

#### Returns

the number of bytes written or `-1` on failure.

## Types and Values

### struct GMimeDataWrapper

    struct GMimeDataWrapper;

A wrapper for a stream which may be encoded.

#### Members

## See Also

GMimePart