diff options
Diffstat (limited to 'docs/reference/pygio-seekable.xml')
-rw-r--r-- | docs/reference/pygio-seekable.xml | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/docs/reference/pygio-seekable.xml b/docs/reference/pygio-seekable.xml new file mode 100644 index 0000000..1081143 --- /dev/null +++ b/docs/reference/pygio-seekable.xml @@ -0,0 +1,231 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> + +<refentry id="class-gioseekable"> + <refnamediv> + <refname>gio.Seekable</refname> + <refpurpose>Stream seeking interface.</refpurpose> + </refnamediv> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>gio.Seekable</classname></ooclass> + <ooclass><classname><link linkend="class-gobjectginterface">gobject.GInterface</link></classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-gioseekable--tell">tell</link></methodname> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-gioseekable--can_seek">can_seek</link></methodname> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-gioseekable--seek">seek</link></methodname> + <methodparam><parameter role="keyword">offset</parameter></methodparam> + <methodparam><parameter role="keyword">type</parameter><initializer>0</initializer></methodparam> + <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-gioseekable--can_truncate">can_truncate</link></methodname> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-gioseekable--truncate">truncate</link></methodname> + <methodparam><parameter role="keyword">offset</parameter></methodparam> + <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam> + </methodsynopsis> + + </classsynopsis> + + </refsect1> + + <refsect1> + <title>Ancestry</title> + +<synopsis>+-- <link linkend="class-gobjectginterface">gobject.GInterface</link> + +-- <link linkend="class-gioseekable">gio.Seekable</link> +</synopsis> + + </refsect1> + + <refsect1> + <title>Known Implementation</title> + <para> + <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link> is implemented by + <link linkend="class-giofileoutputstream"><classname>gio.FileOutputStream</classname></link>, + <link linkend="class-giomemoryinputstream"><classname>gio.MemoryInputStream</classname></link>, + <link linkend="class-giofileinputstream"><classname>gio.FileInputStream</classname></link> and + <link linkend="class-giomemoryoutputstream"><classname>gio.MemoryOutputStream</classname></link>. + </para> + </refsect1> + + <refsect1> + <title>Description</title> + + <para> + <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link> + is implemented by streams (implementations of + <link linkend="class-gioinputstream"><classname>gio.InputStream</classname></link> or + <link linkend="class-giooutputstream"><classname>gio.OutputStream</classname></link>) + that support seeking. + </para> + </refsect1> + + <refsect1> + <title>Methods</title> + + <refsect2 id="method-gioseekable--tell"> + <title>gio.Seekable.tell</title> + + <programlisting><methodsynopsis language="python"> + <methodname>tell</methodname> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara> + the offset from the beginning of the buffer + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Tells the current position within the stream. + </para> + </refsect2> + + <refsect2 id="method-gioseekable--can_seek"> + <title>gio.Seekable.can_seek</title> + + <programlisting><methodsynopsis language="python"> + <methodname>can_seek</methodname> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara><literal>True</literal> if this + <classname>gio.Seekable</classname> can be seeked with + the <methodname>seek</methodname>() method, <literal>False</literal> + if not. </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>can_seek</methodname>() method checks if the + <link linkend="method-gioseekable--seek"><methodname>seek</methodname>()</link> + can be used on this <classname>gio.Seekable</classname>. + </para> + </refsect2> + <refsect2 id="method-gioseekable--seek"> + <title>gio.Seekable.seek</title> + + <programlisting><methodsynopsis language="python"> + <methodname>seek</methodname> + <methodparam><parameter role="keyword">offset</parameter></methodparam> + <methodparam><parameter role="keyword">type</parameter><initializer>0</initializer></methodparam> + <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter>offset</parameter> :</term> + <listitem><simpara>the offset that is added to the position determined by the <literal>type</literal> parameter. + </simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter>type</parameter> :</term> + <listitem><simpara>0=current position, 1=start of the file, 2=end of the file.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter>cancellable</parameter> :</term> + <listitem><simpara>a <link linkend="class-giocancellable"><classname>gio.Cancellable</classname></link> + or <literal>None</literal>.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara><literal>True</literal> on successful seek, + <literal>False</literal> otherwise. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Seeks in the stream by the given <literal>offset</literal>, modified by <literal>type</literal>. + </para> + <para> + If <literal>cancellable</literal> is not <literal>None</literal>, then the + operation can be cancelled by triggering the cancellable object from another thread. + </para> + </refsect2> + <refsect2 id="method-gioseekable--can_truncate"> + <title>gio.Seekable.can_truncate</title> + + <programlisting><methodsynopsis language="python"> + <methodname>can_truncate</methodname> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara><literal>True</literal> if this + <classname>gio.Seekable</classname> can be truncated with + the <methodname>truncate</methodname>() method, <literal>False</literal> + if not. </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>can_truncate</methodname>() method checks if the + <link linkend="method-gioseekable--truncate"><methodname>truncate</methodname>()</link> + can be used on this <classname>gio.Seekable</classname>. + </para> + </refsect2> + <refsect2 id="method-gioseekable--truncate"> + <title>gio.Seekable.truncate</title> + + <programlisting><methodsynopsis language="python"> + <methodname>truncate</methodname> + <methodparam><parameter role="keyword">offset</parameter></methodparam> + <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter>offset</parameter> :</term> + <listitem><simpara>the offset at which the stream should be truncated + </simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter>cancellable</parameter> :</term> + <listitem><simpara>a <link linkend="class-giocancellable"><classname>gio.Cancellable</classname></link> + or <literal>None</literal>.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara><literal>True</literal> if successful, + <literal>False</literal> otherwise. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Truncates a stream with a given <literal>offset</literal>. + </para> + <para> + If <literal>cancellable</literal> is not <literal>None</literal>, then the + operation can be cancelled by triggering the cancellable object from another thread. + </para> + <para> + If an operation was partially finished when the operation was cancelled the + partial result will be returned, without an error. + </para> + </refsect2> + </refsect1> +</refentry> |