<refentry id="GMimeStreamMem">
<refmeta>
<refentrytitle role="top_of_page" id="GMimeStreamMem.top_of_page">GMimeStreamMem</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  GMIME Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GMimeStreamMem</refname>
<refpurpose>A memory-backed stream</refpurpose>
</refnamediv>

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

<synopsis>                    <link linkend="GMimeStreamMem-struct">GMimeStreamMem</link>;
<link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       <link linkend="g-mime-stream-mem-new">g_mime_stream_mem_new</link>               (<parameter><type>void</type></parameter>);
<link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       <link linkend="g-mime-stream-mem-new-with-byte-array">g_mime_stream_mem_new_with_byte_array</link>
                                                        (<parameter><link linkend="GByteArray"><type>GByteArray</type></link> *array</parameter>);
<link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       <link linkend="g-mime-stream-mem-new-with-buffer">g_mime_stream_mem_new_with_buffer</link>   (<parameter>const <link linkend="char"><type>char</type></link> *buffer</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> len</parameter>);
<link linkend="GByteArray"><returnvalue>GByteArray</returnvalue></link> *        <link linkend="g-mime-stream-mem-get-byte-array">g_mime_stream_mem_get_byte_array</link>    (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-stream-mem-set-byte-array">g_mime_stream_mem_set_byte_array</link>    (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>,
                                                         <parameter><link linkend="GByteArray"><type>GByteArray</type></link> *array</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            <link linkend="g-mime-stream-mem-get-owner">g_mime_stream_mem_get_owner</link>         (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-stream-mem-set-owner">g_mime_stream_mem_set_owner</link>         (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>,
                                                         <parameter><link linkend="gboolean"><type>gboolean</type></link> owner</parameter>);
</synopsis>
</refsynopsisdiv>
<refsect1 id="GMimeStreamMem.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----<link linkend="GMimeStream">GMimeStream</link>
         +----GMimeStreamMem
</synopsis>
</refsect1>

<refsect1 id="GMimeStreamMem.description" role="desc">
<title role="desc.title">Description</title>
<para>
A simple <link linkend="GMimeStream"><type>GMimeStream</type></link> implementation that uses a memory buffer for
storage.
</para>
</refsect1>
<refsect1 id="GMimeStreamMem.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GMimeStreamMem-struct" role="struct">
<title>GMimeStreamMem</title>
<indexterm zone="GMimeStreamMem-struct"><primary>GMimeStreamMem</primary></indexterm>
<programlisting>typedef struct _GMimeStreamMem GMimeStreamMem;</programlisting>
<para>
A memory-backed <link linkend="GMimeStream"><type>GMimeStream</type></link>.
</para><variablelist role="struct">
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-new" role="function">
<title>g_mime_stream_mem_new ()</title>
<indexterm zone="g-mime-stream-mem-new"><primary>g_mime_stream_mem_new</primary></indexterm>
<programlisting><link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       g_mime_stream_mem_new               (<parameter><type>void</type></parameter>);</programlisting>
<para>
Creates a new <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> object.
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new memory stream.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-new-with-byte-array" role="function">
<title>g_mime_stream_mem_new_with_byte_array ()</title>
<indexterm zone="g-mime-stream-mem-new-with-byte-array"><primary>g_mime_stream_mem_new_with_byte_array</primary></indexterm>
<programlisting><link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       g_mime_stream_mem_new_with_byte_array
                                                        (<parameter><link linkend="GByteArray"><type>GByteArray</type></link> *array</parameter>);</programlisting>
<para>
Creates a new <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> with data <parameter>array</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>array</parameter>&#160;:</term>
<listitem><simpara>source data
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new memory stream using <parameter>array</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-new-with-buffer" role="function">
<title>g_mime_stream_mem_new_with_buffer ()</title>
<indexterm zone="g-mime-stream-mem-new-with-buffer"><primary>g_mime_stream_mem_new_with_buffer</primary></indexterm>
<programlisting><link linkend="GMimeStream"><returnvalue>GMimeStream</returnvalue></link> *       g_mime_stream_mem_new_with_buffer   (<parameter>const <link linkend="char"><type>char</type></link> *buffer</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> len</parameter>);</programlisting>
<para>
Creates a new <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> object and initializes the stream
contents with the first <parameter>len</parameter> bytes of <parameter>buffer</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>buffer</parameter>&#160;:</term>
<listitem><simpara>stream data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara>buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new memory stream initialized with <parameter>buffer</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-get-byte-array" role="function">
<title>g_mime_stream_mem_get_byte_array ()</title>
<indexterm zone="g-mime-stream-mem-get-byte-array"><primary>g_mime_stream_mem_get_byte_array</primary></indexterm>
<programlisting><link linkend="GByteArray"><returnvalue>GByteArray</returnvalue></link> *        g_mime_stream_mem_get_byte_array    (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>);</programlisting>
<para>
Gets the byte array from the memory stream.
</para><variablelist role="params">
<varlistentry><term><parameter>mem</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the byte array from the memory stream.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-set-byte-array" role="function">
<title>g_mime_stream_mem_set_byte_array ()</title>
<indexterm zone="g-mime-stream-mem-set-byte-array"><primary>g_mime_stream_mem_set_byte_array</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_stream_mem_set_byte_array    (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>,
                                                         <parameter><link linkend="GByteArray"><type>GByteArray</type></link> *array</parameter>);</programlisting>
<para>
Sets the byte array on the memory stream.
</para>
<para>
Note: The memory stream is not responsible for freeing the byte
array. Use <link linkend="g-mime-stream-mem-set-owner"><function>g_mime_stream_mem_set_owner()</function></link> to change this behavior.
</para><variablelist role="params">
<varlistentry><term><parameter>mem</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>array</parameter>&#160;:</term>
<listitem><simpara>stream data
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-get-owner" role="function">
<title>g_mime_stream_mem_get_owner ()</title>
<indexterm zone="g-mime-stream-mem-get-owner"><primary>g_mime_stream_mem_get_owner</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            g_mime_stream_mem_get_owner         (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>);</programlisting>
<para>
Gets whether or not <parameter>mem</parameter> owns the backend memory buffer.
</para><variablelist role="params">
<varlistentry><term><parameter>mem</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>mem</parameter> owns the backend memory buffer or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>
otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-stream-mem-set-owner" role="function">
<title>g_mime_stream_mem_set_owner ()</title>
<indexterm zone="g-mime-stream-mem-set-owner"><primary>g_mime_stream_mem_set_owner</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_stream_mem_set_owner         (<parameter><link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link> *mem</parameter>,
                                                         <parameter><link linkend="gboolean"><type>gboolean</type></link> owner</parameter>);</programlisting>
<para>
Sets whether or not <parameter>mem</parameter> owns the backend memory buffer.
</para>
<para>
Note: <parameter>owner</parameter> should be <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the stream should free the backend
memory buffer when destroyed or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</para><variablelist role="params">
<varlistentry><term><parameter>mem</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeStreamMem"><type>GMimeStreamMem</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>owner</parameter>&#160;:</term>
<listitem><simpara><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if this stream should own the <link linkend="GByteArray"><type>GByteArray</type></link> or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise
</simpara></listitem></varlistentry>
</variablelist></refsect2>

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

</refentry>
