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

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

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

<synopsis>
struct              <link linkend="CamelSeekableStream">CamelSeekableStream</link>;
enum                <link linkend="CamelStreamSeekPolicy">CamelStreamSeekPolicy</link>;
#define             <link linkend="CAMEL-STREAM-UNBOUND:CAPS">CAMEL_STREAM_UNBOUND</link>
<link linkend="off-t">off_t</link>               <link linkend="camel-seekable-stream-seek">camel_seekable_stream_seek</link>          (<link linkend="CamelSeekableStream">CamelSeekableStream</link> *stream,
                                                         <link linkend="off-t">off_t</link> offset,
                                                         <link linkend="CamelStreamSeekPolicy">CamelStreamSeekPolicy</link> policy);
<link linkend="off-t">off_t</link>               <link linkend="camel-seekable-stream-tell">camel_seekable_stream_tell</link>          (<link linkend="CamelSeekableStream">CamelSeekableStream</link> *stream);
<link linkend="int">int</link>                 <link linkend="camel-seekable-stream-set-bounds">camel_seekable_stream_set_bounds</link>    (<link linkend="CamelSeekableStream">CamelSeekableStream</link> *stream,
                                                         <link linkend="off-t">off_t</link> start,
                                                         <link linkend="off-t">off_t</link> end);
</synopsis>
</refsynopsisdiv>









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

</para>
</refsect1>

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

	off_t position;		/* current postion in the stream */
	off_t bound_start;	/* first valid position */
	off_t bound_end;	/* first invalid position */
};
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelStreamSeekPolicy" role="enum">
<title>enum CamelStreamSeekPolicy</title>
<indexterm zone="CamelStreamSeekPolicy"><primary>CamelStreamSeekPolicy</primary></indexterm><programlisting>typedef enum {
	CAMEL_STREAM_SET = SEEK_SET,
	CAMEL_STREAM_CUR = SEEK_CUR,
	CAMEL_STREAM_END = SEEK_END
} CamelStreamSeekPolicy;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CAMEL-STREAM-UNBOUND:CAPS" role="macro">
<title>CAMEL_STREAM_UNBOUND</title>
<indexterm zone="CAMEL-STREAM-UNBOUND:CAPS"><primary>CAMEL_STREAM_UNBOUND</primary></indexterm><programlisting>#define CAMEL_STREAM_UNBOUND (~0)
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-seekable-stream-seek" role="function">
<title>camel_seekable_stream_seek ()</title>
<indexterm zone="camel-seekable-stream-seek"><primary>camel_seekable_stream_seek</primary></indexterm><programlisting><link linkend="off-t">off_t</link>               camel_seekable_stream_seek          (<link linkend="CamelSeekableStream">CamelSeekableStream</link> *stream,
                                                         <link linkend="off-t">off_t</link> offset,
                                                         <link linkend="CamelStreamSeekPolicy">CamelStreamSeekPolicy</link> policy);</programlisting>
<para>
Seek to the specified position in <parameter>stream</parameter>.
</para>
<para>
If <parameter>policy</parameter> is <link linkend="CAMEL-STREAM-SET:CAPS"><type>CAMEL_STREAM_SET</type></link>, seeks to <parameter>offset</parameter>.
</para>
<para>
If <parameter>policy</parameter> is <link linkend="CAMEL-STREAM-CUR:CAPS"><type>CAMEL_STREAM_CUR</type></link>, seeks to the current position plus
<parameter>offset</parameter>.
</para>
<para>
If <parameter>policy</parameter> is <link linkend="CAMEL-STREAM-END:CAPS"><type>CAMEL_STREAM_END</type></link>, seeks to the end of the stream plus
<parameter>offset</parameter>.
</para>
<para>
Regardless of <parameter>policy</parameter>, the stream's final position will be clamped
to the range specified by its lower and upper bounds, and the
stream's eos state will be updated.</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>offset</parameter>&nbsp;:</term>
<listitem><simpara> offset value
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>policy</parameter>&nbsp;:</term>
<listitem><simpara> what to do with the offset
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> new position, <link linkend="1:CAPS"><literal>-1</literal></link> if operation failed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-seekable-stream-tell" role="function">
<title>camel_seekable_stream_tell ()</title>
<indexterm zone="camel-seekable-stream-tell"><primary>camel_seekable_stream_tell</primary></indexterm><programlisting><link linkend="off-t">off_t</link>               camel_seekable_stream_tell          (<link linkend="CamelSeekableStream">CamelSeekableStream</link> *stream);</programlisting>
<para>
Get the current position of a seekable stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelSeekableStream"><type>CamelSeekableStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the current position of the stream.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-seekable-stream-set-bounds" role="function">
<title>camel_seekable_stream_set_bounds ()</title>
<indexterm zone="camel-seekable-stream-set-bounds"><primary>camel_seekable_stream_set_bounds</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_seekable_stream_set_bounds    (<link linkend="CamelSeekableStream">CamelSeekableStream</link> *stream,
                                                         <link linkend="off-t">off_t</link> start,
                                                         <link linkend="off-t">off_t</link> end);</programlisting>
<para>
Set the range of valid data this stream is allowed to cover.  If
there is to be no <parameter>end</parameter> value, then <parameter>end</parameter> should be set to
<link linkend="CAMEL-STREAM-UNBOUND:CAPS"><type>CAMEL_STREAM_UNBOUND</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelSeekableStream"><type>CamelSeekableStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>start</parameter>&nbsp;:</term>
<listitem><simpara> the first valid position
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>end</parameter>&nbsp;:</term>
<listitem><simpara> the first invalid position, or <link linkend="CAMEL-STREAM-UNBOUND:CAPS"><type>CAMEL_STREAM_UNBOUND</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>%-1 on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
