1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
5 <refentry id="class-gioseekable">
7 <refname>gio.Seekable</refname>
8 <refpurpose>Stream seeking interface.</refpurpose>
12 <title>Synopsis</title>
14 <classsynopsis language="python">
15 <ooclass><classname>gio.Seekable</classname></ooclass>
16 <ooclass><classname><link linkend="class-gobjectginterface">gobject.GInterface</link></classname></ooclass>
18 <methodsynopsis language="python">
19 <methodname><link linkend="method-gioseekable--tell">tell</link></methodname>
22 <methodsynopsis language="python">
23 <methodname><link linkend="method-gioseekable--can_seek">can_seek</link></methodname>
26 <methodsynopsis language="python">
27 <methodname><link linkend="method-gioseekable--seek">seek</link></methodname>
28 <methodparam><parameter role="keyword">offset</parameter></methodparam>
29 <methodparam><parameter role="keyword">type</parameter><initializer>0</initializer></methodparam>
30 <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam>
33 <methodsynopsis language="python">
34 <methodname><link linkend="method-gioseekable--can_truncate">can_truncate</link></methodname>
37 <methodsynopsis language="python">
38 <methodname><link linkend="method-gioseekable--truncate">truncate</link></methodname>
39 <methodparam><parameter role="keyword">offset</parameter></methodparam>
40 <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam>
48 <title>Ancestry</title>
50 <synopsis>+-- <link linkend="class-gobjectginterface">gobject.GInterface</link>
51 +-- <link linkend="class-gioseekable">gio.Seekable</link>
57 <title>Known Implementation</title>
59 <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link> is implemented by
60 <link linkend="class-giofileoutputstream"><classname>gio.FileOutputStream</classname></link>,
61 <link linkend="class-giomemoryinputstream"><classname>gio.MemoryInputStream</classname></link>,
62 <link linkend="class-giofileinputstream"><classname>gio.FileInputStream</classname></link> and
63 <link linkend="class-giomemoryoutputstream"><classname>gio.MemoryOutputStream</classname></link>.
68 <title>Description</title>
71 <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link>
72 is implemented by streams (implementations of
73 <link linkend="class-gioinputstream"><classname>gio.InputStream</classname></link> or
74 <link linkend="class-giooutputstream"><classname>gio.OutputStream</classname></link>)
80 <title>Methods</title>
82 <refsect2 id="method-gioseekable--tell">
83 <title>gio.Seekable.tell</title>
85 <programlisting><methodsynopsis language="python">
86 <methodname>tell</methodname>
87 </methodsynopsis></programlisting>
91 <term><emphasis>Returns</emphasis> :</term>
93 the offset from the beginning of the buffer
99 Tells the current position within the stream.
103 <refsect2 id="method-gioseekable--can_seek">
104 <title>gio.Seekable.can_seek</title>
106 <programlisting><methodsynopsis language="python">
107 <methodname>can_seek</methodname>
108 </methodsynopsis></programlisting>
112 <term><emphasis>Returns</emphasis> :</term>
113 <listitem><simpara><literal>True</literal> if this
114 <classname>gio.Seekable</classname> can be seeked with
115 the <methodname>seek</methodname>() method, <literal>False</literal>
116 if not. </simpara></listitem>
121 The <methodname>can_seek</methodname>() method checks if the
122 <link linkend="method-gioseekable--seek"><methodname>seek</methodname>()</link>
123 can be used on this <classname>gio.Seekable</classname>.
126 <refsect2 id="method-gioseekable--seek">
127 <title>gio.Seekable.seek</title>
129 <programlisting><methodsynopsis language="python">
130 <methodname>seek</methodname>
131 <methodparam><parameter role="keyword">offset</parameter></methodparam>
132 <methodparam><parameter role="keyword">type</parameter><initializer>0</initializer></methodparam>
133 <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam>
134 </methodsynopsis></programlisting>
138 <term><parameter>offset</parameter> :</term>
139 <listitem><simpara>the offset that is added to the position determined by the <literal>type</literal> parameter.
140 </simpara></listitem>
143 <term><parameter>type</parameter> :</term>
144 <listitem><simpara>0=current position, 1=start of the file, 2=end of the file.</simpara></listitem>
147 <term><parameter>cancellable</parameter> :</term>
148 <listitem><simpara>a <link linkend="class-giocancellable"><classname>gio.Cancellable</classname></link>
149 or <literal>None</literal>.</simpara></listitem>
152 <term><emphasis>Returns</emphasis> :</term>
153 <listitem><simpara><literal>True</literal> on successful seek,
154 <literal>False</literal> otherwise.
155 </simpara></listitem>
160 Seeks in the stream by the given <literal>offset</literal>, modified by <literal>type</literal>.
163 If <literal>cancellable</literal> is not <literal>None</literal>, then the
164 operation can be cancelled by triggering the cancellable object from another thread.
167 <refsect2 id="method-gioseekable--can_truncate">
168 <title>gio.Seekable.can_truncate</title>
170 <programlisting><methodsynopsis language="python">
171 <methodname>can_truncate</methodname>
172 </methodsynopsis></programlisting>
176 <term><emphasis>Returns</emphasis> :</term>
177 <listitem><simpara><literal>True</literal> if this
178 <classname>gio.Seekable</classname> can be truncated with
179 the <methodname>truncate</methodname>() method, <literal>False</literal>
180 if not. </simpara></listitem>
185 The <methodname>can_truncate</methodname>() method checks if the
186 <link linkend="method-gioseekable--truncate"><methodname>truncate</methodname>()</link>
187 can be used on this <classname>gio.Seekable</classname>.
190 <refsect2 id="method-gioseekable--truncate">
191 <title>gio.Seekable.truncate</title>
193 <programlisting><methodsynopsis language="python">
194 <methodname>truncate</methodname>
195 <methodparam><parameter role="keyword">offset</parameter></methodparam>
196 <methodparam><parameter role="keyword">cancellable</parameter><initializer><literal>None</literal></initializer></methodparam>
197 </methodsynopsis></programlisting>
201 <term><parameter>offset</parameter> :</term>
202 <listitem><simpara>the offset at which the stream should be truncated
203 </simpara></listitem>
206 <term><parameter>cancellable</parameter> :</term>
207 <listitem><simpara>a <link linkend="class-giocancellable"><classname>gio.Cancellable</classname></link>
208 or <literal>None</literal>.</simpara></listitem>
211 <term><emphasis>Returns</emphasis> :</term>
212 <listitem><simpara><literal>True</literal> if successful,
213 <literal>False</literal> otherwise.
214 </simpara></listitem>
219 Truncates a stream with a given <literal>offset</literal>.
222 If <literal>cancellable</literal> is not <literal>None</literal>, then the
223 operation can be cancelled by triggering the cancellable object from another thread.
226 If an operation was partially finished when the operation was cancelled the
227 partial result will be returned, without an error.