1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GSeekable</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="streaming.html" title="Streaming I/O">
9 <link rel="prev" href="streaming.html" title="Streaming I/O">
10 <link rel="next" href="GInputStream.html" title="GInputStream">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17 <td><a accesskey="p" href="streaming.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="streaming.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GIO Reference Manual</th>
21 <td><a accesskey="n" href="GInputStream.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#GSeekable.synopsis" class="shortcut">Top</a>
26 <a href="#GSeekable.description" class="shortcut">Description</a>
28 <a href="#GSeekable.object-hierarchy" class="shortcut">Object Hierarchy</a>
30 <a href="#GSeekable.prerequisites" class="shortcut">Prerequisites</a>
32 <a href="#GSeekable.implementations" class="shortcut">Known Implementations</a>
35 <div class="refentry">
36 <a name="GSeekable"></a><div class="titlepage"></div>
37 <div class="refnamediv"><table width="100%"><tr>
39 <h2><span class="refentrytitle"><a name="GSeekable.top_of_page"></a>GSeekable</span></h2>
40 <p>GSeekable — Stream seeking interface</p>
42 <td valign="top" align="right"></td>
44 <div class="refsynopsisdiv">
45 <a name="GSeekable.synopsis"></a><h2>Synopsis</h2>
46 <pre class="synopsis">
47 #include <gio/gio.h>
49 <a class="link" href="GSeekable.html#GSeekable-struct" title="GSeekable">GSeekable</a>;
50 struct <a class="link" href="GSeekable.html#GSeekableIface" title="struct GSeekableIface">GSeekableIface</a>;
51 <a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> <a class="link" href="GSeekable.html#g-seekable-tell" title="g_seekable_tell ()">g_seekable_tell</a> (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>);
52 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GSeekable.html#g-seekable-can-seek" title="g_seekable_can_seek ()">g_seekable_can_seek</a> (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>);
53 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GSeekable.html#g-seekable-seek" title="g_seekable_seek ()">g_seekable_seek</a> (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>,
54 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a> offset</code></em>,
55 <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GSeekType"><span class="type">GSeekType</span></a> type</code></em>,
56 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
57 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
58 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GSeekable.html#g-seekable-can-truncate" title="g_seekable_can_truncate ()">g_seekable_can_truncate</a> (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>);
59 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GSeekable.html#g-seekable-truncate" title="g_seekable_truncate ()">g_seekable_truncate</a> (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>,
60 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a> offset</code></em>,
61 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
62 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
65 <div class="refsect1">
66 <a name="GSeekable.object-hierarchy"></a><h2>Object Hierarchy</h2>
67 <pre class="synopsis">
72 <div class="refsect1">
73 <a name="GSeekable.prerequisites"></a><h2>Prerequisites</h2>
76 <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
78 <div class="refsect1">
79 <a name="GSeekable.implementations"></a><h2>Known Implementations</h2>
81 GSeekable is implemented by
82 <a class="link" href="GFileIOStream.html" title="GFileIOStream">GFileIOStream</a>, <a class="link" href="GFileInputStream.html" title="GFileInputStream">GFileInputStream</a>, <a class="link" href="GFileOutputStream.html" title="GFileOutputStream">GFileOutputStream</a>, <a class="link" href="GMemoryInputStream.html" title="GMemoryInputStream">GMemoryInputStream</a> and <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a>.</p>
84 <div class="refsect1">
85 <a name="GSeekable.description"></a><h2>Description</h2>
87 <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> is implemented by streams (implementations of
88 <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> or <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>) that support seeking.
91 <div class="refsect1">
92 <a name="GSeekable.details"></a><h2>Details</h2>
93 <div class="refsect2">
94 <a name="GSeekable-struct"></a><h3>GSeekable</h3>
95 <pre class="programlisting">typedef struct _GSeekable GSeekable;</pre>
97 Seek object for streaming operations.
101 <div class="refsect2">
102 <a name="GSeekableIface"></a><h3>struct GSeekableIface</h3>
103 <pre class="programlisting">struct GSeekableIface {
104 GTypeInterface g_iface;
108 goffset (* tell) (GSeekable *seekable);
110 gboolean (* can_seek) (GSeekable *seekable);
111 gboolean (* seek) (GSeekable *seekable,
114 GCancellable *cancellable,
117 gboolean (* can_truncate) (GSeekable *seekable);
118 gboolean (* truncate_fn) (GSeekable *seekable,
120 GCancellable *cancellable,
123 /* TODO: Async seek/truncate */
127 Provides an interface for implementing seekable functionality on I/O Streams.
129 <div class="variablelist"><table border="0">
130 <col align="left" valign="top">
133 <td><p><span class="term"><a href="./../gobject/gobject/gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> <em class="structfield"><code><a name="GSeekableIface.g-iface"></a>g_iface</code></em>;</span></p></td>
134 <td>The parent interface.</td>
137 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.tell"></a>tell</code></em> ()</span></p></td>
138 <td>Tells the current location within a stream.</td>
141 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.can-seek"></a>can_seek</code></em> ()</span></p></td>
142 <td>Checks if seeking is supported by the stream.</td>
145 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.seek"></a>seek</code></em> ()</span></p></td>
146 <td>Seeks to a location within a stream.</td>
149 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.can-truncate"></a>can_truncate</code></em> ()</span></p></td>
150 <td>Checks if truncation is supported by the stream.</td>
153 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.truncate-fn"></a>truncate_fn</code></em> ()</span></p></td>
154 <td>Truncates a stream.</td>
160 <div class="refsect2">
161 <a name="g-seekable-tell"></a><h3>g_seekable_tell ()</h3>
162 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> g_seekable_tell (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>);</pre>
164 Tells the current position within the stream.
166 <div class="variablelist"><table border="0">
167 <col align="left" valign="top">
170 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
171 <td>a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.</td>
174 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
175 <td>the offset from the beginning of the buffer.</td>
181 <div class="refsect2">
182 <a name="g-seekable-can-seek"></a><h3>g_seekable_can_seek ()</h3>
183 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_can_seek (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>);</pre>
185 Tests if the stream supports the <a class="link" href="GSeekable.html#GSeekableIface" title="struct GSeekableIface"><span class="type">GSeekableIface</span></a>.
187 <div class="variablelist"><table border="0">
188 <col align="left" valign="top">
191 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
192 <td>a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.</td>
195 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
197 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>seekable</code></em> can be seeked. <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
203 <div class="refsect2">
204 <a name="g-seekable-seek"></a><h3>g_seekable_seek ()</h3>
205 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_seek (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>,
206 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a> offset</code></em>,
207 <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GSeekType"><span class="type">GSeekType</span></a> type</code></em>,
208 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
209 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
211 Seeks in the stream by the given <em class="parameter"><code>offset</code></em>, modified by <em class="parameter"><code>type</code></em>.
214 If <em class="parameter"><code>cancellable</code></em> is not <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the operation can be cancelled by
215 triggering the cancellable object from another thread. If the operation
216 was cancelled, the error <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> will be returned.
218 <div class="variablelist"><table border="0">
219 <col align="left" valign="top">
222 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
223 <td>a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.</td>
226 <td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
227 <td>a <a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a>.</td>
230 <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
231 <td>a <a href="./../glib/glib/glib-IO-Channels.html#GSeekType"><span class="type">GSeekType</span></a>.</td>
234 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
235 <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
239 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
240 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occurring, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
244 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
246 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful. If an error
247 has occurred, this function will return <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
248 appropriately if present.</td>
254 <div class="refsect2">
255 <a name="g-seekable-can-truncate"></a><h3>g_seekable_can_truncate ()</h3>
256 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_can_truncate (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>);</pre>
258 Tests if the stream can be truncated.
260 <div class="variablelist"><table border="0">
261 <col align="left" valign="top">
264 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
265 <td>a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.</td>
268 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
270 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the stream can be truncated, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
276 <div class="refsect2">
277 <a name="g-seekable-truncate"></a><h3>g_seekable_truncate ()</h3>
278 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_truncate (<em class="parameter"><code><a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> *seekable</code></em>,
279 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a> offset</code></em>,
280 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
281 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
283 Truncates a stream with a given <span class="type">offset</span>.
286 If <em class="parameter"><code>cancellable</code></em> is not <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the operation can be cancelled by
287 triggering the cancellable object from another thread. If the operation
288 was cancelled, the error <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> will be returned. If an
289 operation was partially finished when the operation was cancelled the
290 partial result will be returned, without an error.
295 <div class="variablelist"><table border="0">
296 <col align="left" valign="top">
299 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
300 <td>a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.</td>
303 <td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
304 <td>a <a href="./../glib/glib/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a>.</td>
307 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
308 <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
312 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
313 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occurring, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
317 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
319 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful. If an error
320 has occurred, this function will return <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
321 appropriately if present.</td>
327 <div class="refsect1">
328 <a name="GSeekable.see-also"></a><h2>See Also</h2>
329 <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>, <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>
334 Generated by GTK-Doc V1.18</div>