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

<refnamediv>
<refname>CamelStream</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

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

<synopsis>
struct              <link linkend="CamelStream">CamelStream</link>;
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-stream-read">camel_stream_read</link>                   (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> n);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-stream-write">camel_stream_write</link>                  (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> n);
<link linkend="int">int</link>                 <link linkend="camel-stream-flush">camel_stream_flush</link>                  (<link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="int">int</link>                 <link linkend="camel-stream-close">camel_stream_close</link>                  (<link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="gboolean">gboolean</link>            <link linkend="camel-stream-eos">camel_stream_eos</link>                    (<link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="int">int</link>                 <link linkend="camel-stream-reset">camel_stream_reset</link>                  (<link linkend="CamelStream">CamelStream</link> *stream);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-stream-write-string">camel_stream_write_string</link>           (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *string);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-stream-printf">camel_stream_printf</link>                 (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *fmt,
                                                         ...);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-stream-vprintf">camel_stream_vprintf</link>                (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *fmt,
                                                         <link linkend="va-list">va_list</link> ap);
<link linkend="ssize-t">ssize_t</link>             <link linkend="camel-stream-write-to-stream">camel_stream_write_to_stream</link>        (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         <link linkend="CamelStream">CamelStream</link> *output_stream);
</synopsis>
</refsynopsisdiv>









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

</para>
</refsect1>

<refsect1 id="camel-CamelStream.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelStream" role="struct">
<title>struct CamelStream</title>
<indexterm zone="CamelStream"><primary>CamelStream</primary></indexterm><programlisting>struct CamelStream {
	CamelObject parent_object;

	gboolean eos;
};
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-stream-read" role="function">
<title>camel_stream_read ()</title>
<indexterm zone="camel-stream-read"><primary>camel_stream_read</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_stream_read                   (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> n);</programlisting>
<para>
Attempts to read up to <parameter>len</parameter> bytes from <parameter>stream</parameter> into <parameter>buf</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara> max number of bytes to read.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the number of bytes actually read, or <link linkend="1:CAPS"><literal>-1</literal></link> on error and set
errno.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-write" role="function">
<title>camel_stream_write ()</title>
<indexterm zone="camel-stream-write"><primary>camel_stream_write</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_stream_write                  (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> n);</programlisting>
<para>
Attempts to write up to <parameter>n</parameter> bytes of <parameter>buffer</parameter> into <parameter>stream</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> buffer to write.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara> number of bytes to write
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the number of bytes written to the stream, or <link linkend="1:CAPS"><literal>-1</literal></link> on error
along with setting errno.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-flush" role="function">
<title>camel_stream_flush ()</title>
<indexterm zone="camel-stream-flush"><primary>camel_stream_flush</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_stream_flush                  (<link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Flushes any buffered data to the stream's backing store.  Only
meaningful for writable streams.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>%0 on success or <link linkend="1:CAPS"><literal>-1</literal></link> on fail along with setting errno.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-close" role="function">
<title>camel_stream_close ()</title>
<indexterm zone="camel-stream-close"><primary>camel_stream_close</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_stream_close                  (<link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Closes the stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>%0 on success or <link linkend="1:CAPS"><literal>-1</literal></link> on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-eos" role="function">
<title>camel_stream_eos ()</title>
<indexterm zone="camel-stream-eos"><primary>camel_stream_eos</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            camel_stream_eos                    (<link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Tests if there are bytes left to read on the <parameter>stream</parameter> object.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>%TRUE on EOS or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-reset" role="function">
<title>camel_stream_reset ()</title>
<indexterm zone="camel-stream-reset"><primary>camel_stream_reset</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_stream_reset                  (<link linkend="CamelStream">CamelStream</link> *stream);</programlisting>
<para>
Resets the stream. That is, put it in a state where it can be read
from the beginning again. Not all streams in Camel are seekable,
but they must all be resettable.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>%0 on success or <link linkend="1:CAPS"><literal>-1</literal></link> on error along with setting errno.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-write-string" role="function">
<title>camel_stream_write_string ()</title>
<indexterm zone="camel-stream-write-string"><primary>camel_stream_write_string</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_stream_write_string           (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *string);</programlisting>
<para>
Writes the string to the stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>string</parameter>&nbsp;:</term>
<listitem><simpara> a string
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the number of characters written or <link linkend="1:CAPS"><literal>-1</literal></link> on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-printf" role="function">
<title>camel_stream_printf ()</title>
<indexterm zone="camel-stream-printf"><primary>camel_stream_printf</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_stream_printf                 (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *fmt,
                                                         ...);</programlisting>
<para>
Write formatted output to a stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fmt</parameter>&nbsp;:</term>
<listitem><simpara> a printf-style format string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the number of characters written or <link linkend="1:CAPS"><literal>-1</literal></link> on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-vprintf" role="function">
<title>camel_stream_vprintf ()</title>
<indexterm zone="camel-stream-vprintf"><primary>camel_stream_vprintf</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_stream_vprintf                (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         const <link linkend="char">char</link> *fmt,
                                                         <link linkend="va-list">va_list</link> ap);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fmt</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ap</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-stream-write-to-stream" role="function">
<title>camel_stream_write_to_stream ()</title>
<indexterm zone="camel-stream-write-to-stream"><primary>camel_stream_write_to_stream</primary></indexterm><programlisting><link linkend="ssize-t">ssize_t</link>             camel_stream_write_to_stream        (<link linkend="CamelStream">CamelStream</link> *stream,
                                                         <link linkend="CamelStream">CamelStream</link> *output_stream);</programlisting>
<para>
Write all of a stream (until eos) into another stream, in a
blocking fashion.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> source <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>output_stream</parameter>&nbsp;:</term>
<listitem><simpara> destination <link linkend="CamelStream"><type>CamelStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>%-1 on error, or the number of bytes succesfully
copied across streams.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
