<refentry id="GMimeDataWrapper">
<refmeta>
<refentrytitle role="top_of_page" id="GMimeDataWrapper.top_of_page">GMimeDataWrapper</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  GMIME Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GMimeDataWrapper</refname>
<refpurpose>Content objects</refpurpose>
</refnamediv>

<refsynopsisdiv id="GMimeDataWrapper.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>                    <link linkend="GMimeDataWrapper-struct">GMimeDataWrapper</link>;
<link linkend="GMimeDataWrapper"><returnvalue>GMimeDataWrapper</returnvalue></link> *  <link linkend="g-mime-data-wrapper-new">g_mime_data_wrapper_new</link>             (<parameter><type>void</type></parameter>);
<link linkend="GMimeDataWrapper"><returnvalue>GMimeDataWrapper</returnvalue></link> *  <link linkend="g-mime-data-wrapper-new-with-stream">g_mime_data_wrapper_new_with_stream</link> (<parameter><link linkend="GMimeStream"><type>GMimeStream</type></link> *stream</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-data-wrapper-set-stream">g_mime_data_wrapper_set_stream</link>      (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>,
                                                         <parameter><link linkend="GMimeStream"><type>GMimeStream</type></link> *stream</parameter>);
<link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       <link linkend="g-mime-data-wrapper-get-stream">g_mime_data_wrapper_get_stream</link>      (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-data-wrapper-set-encoding">g_mime_data_wrapper_set_encoding</link>    (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);
<link linkend="GMimeContentEncoding"><returnvalue>GMimeContentEncoding</returnvalue></link>  <link linkend="g-mime-data-wrapper-get-encoding">g_mime_data_wrapper_get_encoding</link>  (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>);
<link linkend="ssize-t"><returnvalue>ssize_t</returnvalue></link>             <link linkend="g-mime-data-wrapper-write-to-stream">g_mime_data_wrapper_write_to_stream</link> (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>,
                                                         <parameter><link linkend="GMimeStream"><type>GMimeStream</type></link> *stream</parameter>);
</synopsis>
</refsynopsisdiv>
<refsect1 id="GMimeDataWrapper.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GMimeDataWrapper
</synopsis>
</refsect1>

<refsect1 id="GMimeDataWrapper.description" role="desc">
<title role="desc.title">Description</title>
<para>
A <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> is a wrapper object for a <link linkend="GMimePart"><type>GMimePart</type></link>'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).
</para>
</refsect1>
<refsect1 id="GMimeDataWrapper.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GMimeDataWrapper-struct" role="struct">
<title>GMimeDataWrapper</title>
<indexterm zone="GMimeDataWrapper-struct"><primary>GMimeDataWrapper</primary></indexterm>
<programlisting>typedef struct _GMimeDataWrapper GMimeDataWrapper;</programlisting>
<para>
A wrapper for a stream which may be encoded.
</para><variablelist role="struct">
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-new" role="function">
<title>g_mime_data_wrapper_new ()</title>
<indexterm zone="g-mime-data-wrapper-new"><primary>g_mime_data_wrapper_new</primary></indexterm>
<programlisting><link linkend="GMimeDataWrapper"><returnvalue>GMimeDataWrapper</returnvalue></link> *  g_mime_data_wrapper_new             (<parameter><type>void</type></parameter>);</programlisting>
<para>
Creates a new <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> object.
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new data wrapper object.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-new-with-stream" role="function">
<title>g_mime_data_wrapper_new_with_stream ()</title>
<indexterm zone="g-mime-data-wrapper-new-with-stream"><primary>g_mime_data_wrapper_new_with_stream</primary></indexterm>
<programlisting><link linkend="GMimeDataWrapper"><returnvalue>GMimeDataWrapper</returnvalue></link> *  g_mime_data_wrapper_new_with_stream (<parameter><link linkend="GMimeStream"><type>GMimeStream</type></link> *stream</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);</programlisting>
<para>
Creates a new <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> object around <parameter>stream</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeStream"><type>GMimeStream</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>encoding</parameter>&#160;:</term>
<listitem><simpara>stream's encoding
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a data wrapper around <parameter>stream</parameter>. Since the wrapper owns its
own reference on the stream, caller is responsible for unrefing
its own copy.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-set-stream" role="function">
<title>g_mime_data_wrapper_set_stream ()</title>
<indexterm zone="g-mime-data-wrapper-set-stream"><primary>g_mime_data_wrapper_set_stream</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_data_wrapper_set_stream      (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>,
                                                         <parameter><link linkend="GMimeStream"><type>GMimeStream</type></link> *stream</parameter>);</programlisting>
<para>
Replaces the wrapper's internal stream with <parameter>stream</parameter>. Don't forget,
if <parameter>stream</parameter> is not of the same encoding as the old stream, you'll
want to call <link linkend="g-mime-data-wrapper-set-encoding"><function>g_mime_data_wrapper_set_encoding()</function></link> as well.
</para>
<para>
Note: caller is responsible for its own reference on
<parameter>stream</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>wrapper</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeStream"><type>GMimeStream</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-get-stream" role="function">
<title>g_mime_data_wrapper_get_stream ()</title>
<indexterm zone="g-mime-data-wrapper-get-stream"><primary>g_mime_data_wrapper_get_stream</primary></indexterm>
<programlisting><link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       g_mime_data_wrapper_get_stream      (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>);</programlisting>
<para>
Gets a reference to the stream wrapped by <parameter>wrapper</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>wrapper</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a reference to the internal stream.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-set-encoding" role="function">
<title>g_mime_data_wrapper_set_encoding ()</title>
<indexterm zone="g-mime-data-wrapper-set-encoding"><primary>g_mime_data_wrapper_set_encoding</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_data_wrapper_set_encoding    (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);</programlisting>
<para>
Sets the encoding type of the internal stream.
</para><variablelist role="params">
<varlistentry><term><parameter>wrapper</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>encoding</parameter>&#160;:</term>
<listitem><simpara>encoding
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-get-encoding" role="function">
<title>g_mime_data_wrapper_get_encoding ()</title>
<indexterm zone="g-mime-data-wrapper-get-encoding"><primary>g_mime_data_wrapper_get_encoding</primary></indexterm>
<programlisting><link linkend="GMimeContentEncoding"><returnvalue>GMimeContentEncoding</returnvalue></link>  g_mime_data_wrapper_get_encoding  (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>);</programlisting>
<para>
Gets the encoding type of the stream wrapped by <parameter>wrapper</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>wrapper</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the encoding type of the internal stream.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-data-wrapper-write-to-stream" role="function">
<title>g_mime_data_wrapper_write_to_stream ()</title>
<indexterm zone="g-mime-data-wrapper-write-to-stream"><primary>g_mime_data_wrapper_write_to_stream</primary></indexterm>
<programlisting><link linkend="ssize-t"><returnvalue>ssize_t</returnvalue></link>             g_mime_data_wrapper_write_to_stream (<parameter><link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link> *wrapper</parameter>,
                                                         <parameter><link linkend="GMimeStream"><type>GMimeStream</type></link> *stream</parameter>);</programlisting>
<para>
Writes the raw (decoded) data to the output stream.
</para><variablelist role="params">
<varlistentry><term><parameter>wrapper</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeDataWrapper"><type>GMimeDataWrapper</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara>output stream
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes written or <link linkend="1:CAPS"><literal>-1</literal></link> on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GMimeDataWrapper.see-also">
<title>See Also</title>
<link linkend="GMimePart"><type>GMimePart</type></link>
</refsect1>

</refentry>
