<refentry id="camel-CamelDataWrapper">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelDataWrapper.top_of_page">CamelDataWrapper</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelDataWrapper</refname>
<refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv id="camel-CamelDataWrapper.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
struct              <link linkend="CamelDataWrapper">CamelDataWrapper</link>;
<link linkend="CamelDataWrapper">CamelDataWrapper</link> *  <link linkend="camel-data-wrapper-new">camel_data_wrapper_new</link>              (void);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-data-wrapper-write-to-stream">camel_data_wrapper_write_to_stream</link>  (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-data-wrapper-decode-to-stream">camel_data_wrapper_decode_to_stream</link> (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="void">void</link>                <link linkend="camel-data-wrapper-set-mime-type">camel_data_wrapper_set_mime_type</link>    (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         const <link linkend="char">char</link> *mime_type);
<link linkend="char">char</link> *              <link linkend="camel-data-wrapper-get-mime-type">camel_data_wrapper_get_mime_type</link>    (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper);
<link linkend="CamelContentType">CamelContentType</link> *  <link linkend="camel-data-wrapper-get-mime-type-field">camel_data_wrapper_get_mime_type_field</link>
                                                        (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper);
<link linkend="void">void</link>                <link linkend="camel-data-wrapper-set-mime-type-field">camel_data_wrapper_set_mime_type_field</link>
                                                        (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelContentType">CamelContentType</link> *mime_type);
<link linkend="int">int</link>                 <link linkend="camel-data-wrapper-construct-from-stream">camel_data_wrapper_construct_from_stream</link>
                                                        (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="gboolean">gboolean</link>            <link linkend="camel-data-wrapper-is-offline">camel_data_wrapper_is_offline</link>       (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelDataWrapper.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="camel-CamelDataWrapper.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelDataWrapper" role="struct">
<title>struct CamelDataWrapper</title>
<indexterm zone="CamelDataWrapper"><primary sortas="CamelDataWrapper">CamelDataWrapper</primary></indexterm><programlisting>struct CamelDataWrapper {
	CamelObject parent_object;
	struct _CamelDataWrapperPrivate *priv;
	
	CamelTransferEncoding encoding;
	
	CamelContentType *mime_type;
	CamelStream *stream;
	
	unsigned int offline:1;
};
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-data-wrapper-new" role="function">
<title>camel_data_wrapper_new ()</title>
<indexterm zone="camel-data-wrapper-new"><primary sortas="camel_data_wrapper_new">camel_data_wrapper_new</primary></indexterm><programlisting><link linkend="CamelDataWrapper">CamelDataWrapper</link> *  camel_data_wrapper_new              (void);</programlisting>
<para>
Create a new <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-write-to-stream" role="function">
<title>camel_data_wrapper_write_to_stream ()</title>
<indexterm zone="camel-data-wrapper-write-to-stream"><primary sortas="camel_data_wrapper_write_to_stream">camel_data_wrapper_write_to_stream</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_data_wrapper_write_to_stream  (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Writes the content of <parameter>data_wrapper</parameter> to <parameter>stream</parameter> in a machine-independent
format appropriate for the data. It should be possible to construct an
equivalent data wrapper object later by passing this stream to
<link linkend="camel-data-wrapper-construct-from-stream"><type>camel_data_wrapper_construct_from_stream</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> for output
</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 fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-decode-to-stream" role="function">
<title>camel_data_wrapper_decode_to_stream ()</title>
<indexterm zone="camel-data-wrapper-decode-to-stream"><primary sortas="camel_data_wrapper_decode_to_stream">camel_data_wrapper_decode_to_stream</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_data_wrapper_decode_to_stream (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Writes the decoded data content to <parameter>stream</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> for decoded data to be written to
</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 fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-set-mime-type" role="function">
<title>camel_data_wrapper_set_mime_type ()</title>
<indexterm zone="camel-data-wrapper-set-mime-type"><primary sortas="camel_data_wrapper_set_mime_type">camel_data_wrapper_set_mime_type</primary></indexterm><programlisting><link linkend="void">void</link>                camel_data_wrapper_set_mime_type    (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         const <link linkend="char">char</link> *mime_type);</programlisting>
<para>
This sets the data wrapper's MIME type.
</para>
<para>
It might fail, but you won't know. It will allow you to set
Content-Type parameters on the data wrapper, which are meaningless.
You should not be allowed to change the MIME type of a data wrapper
that contains data, or at least, if you do, it should invalidate the
data.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mime_type</parameter>&#160;:</term>
<listitem><simpara> a MIME type
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-get-mime-type" role="function">
<title>camel_data_wrapper_get_mime_type ()</title>
<indexterm zone="camel-data-wrapper-get-mime-type"><primary sortas="camel_data_wrapper_get_mime_type">camel_data_wrapper_get_mime_type</primary></indexterm><programlisting><link linkend="char">char</link> *              camel_data_wrapper_get_mime_type    (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the MIME type which must be freed by the caller
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-get-mime-type-field" role="function">
<title>camel_data_wrapper_get_mime_type_field ()</title>
<indexterm zone="camel-data-wrapper-get-mime-type-field"><primary sortas="camel_data_wrapper_get_mime_type_field">camel_data_wrapper_get_mime_type_field</primary></indexterm><programlisting><link linkend="CamelContentType">CamelContentType</link> *  camel_data_wrapper_get_mime_type_field
                                                        (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the parsed form of the data wrapper's MIME type
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-set-mime-type-field" role="function">
<title>camel_data_wrapper_set_mime_type_field ()</title>
<indexterm zone="camel-data-wrapper-set-mime-type-field"><primary sortas="camel_data_wrapper_set_mime_type_field">camel_data_wrapper_set_mime_type_field</primary></indexterm><programlisting><link linkend="void">void</link>                camel_data_wrapper_set_mime_type_field
                                                        (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelContentType">CamelContentType</link> *mime_type);</programlisting>
<para>
This sets the data wrapper's MIME type. It suffers from the same
flaws as <link linkend="camel-data-wrapper-set-mime-type"><type>camel_data_wrapper_set_mime_type</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mime_type</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelContentType"><type>CamelContentType</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-construct-from-stream" role="function">
<title>camel_data_wrapper_construct_from_stream ()</title>
<indexterm zone="camel-data-wrapper-construct-from-stream"><primary sortas="camel_data_wrapper_construct_from_stream">camel_data_wrapper_construct_from_stream</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_data_wrapper_construct_from_stream
                                                        (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper,
                                                         <link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Constructs the content of <parameter>data_wrapper</parameter> from the supplied <parameter>stream</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> an input <link linkend="CamelStream"><type>CamelStream</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0--CAPS"><literal>0</literal></link> on success or <link linkend="1--CAPS"><literal>-1</literal></link> on fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-wrapper-is-offline" role="function">
<title>camel_data_wrapper_is_offline ()</title>
<indexterm zone="camel-data-wrapper-is-offline"><primary sortas="camel_data_wrapper_is_offline">camel_data_wrapper_is_offline</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            camel_data_wrapper_is_offline       (<link linkend="CamelDataWrapper">CamelDataWrapper</link> *data_wrapper);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>data_wrapper</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelDataWrapper"><type>CamelDataWrapper</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> whether <parameter>data_wrapper</parameter> is "offline" (data stored
remotely) or not. Some optional code paths may choose to not
operate on offline data.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
