GMimeDataWrapper

GMimeDataWrapper — Content objects

Synopsis

                    GMimeDataWrapper;
GMimeDataWrapper*   g_mime_data_wrapper_new             (void);
GMimeDataWrapper*   g_mime_data_wrapper_new_with_stream (GMimeStream *stream,
                                                         GMimeContentEncoding encoding);
void                g_mime_data_wrapper_set_stream      (GMimeDataWrapper *wrapper,
                                                         GMimeStream *stream);
GMimeStream*        g_mime_data_wrapper_get_stream      (GMimeDataWrapper *wrapper);
void                g_mime_data_wrapper_set_encoding    (GMimeDataWrapper *wrapper,
                                                         GMimeContentEncoding encoding);
GMimeContentEncoding g_mime_data_wrapper_get_encoding   (GMimeDataWrapper *wrapper);
ssize_t             g_mime_data_wrapper_write_to_stream (GMimeDataWrapper *wrapper,
                                                         GMimeStream *stream);

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

Details

GMimeDataWrapper

typedef struct _GMimeDataWrapper GMimeDataWrapper;

A wrapper for a stream which may be encoded.


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.

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.

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.

wrapper :

a GMimeDataWrapper

Returns :

a reference to the internal stream. Caller is responsible for unrefing it.

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.

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.

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.

wrapper :

a GMimeDataWrapper

stream :

output stream

Returns :

the number of bytes written or -1 on failure.

See Also

GMimePart