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.75.2">
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.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="part" href="pt01.html" title="Part I. GIO Overview">
14 <link rel="chapter" href="ch01.html" title="Introduction">
15 <link rel="chapter" href="ch02.html" title="Compiling GIO applications">
16 <link rel="chapter" href="ch03.html" title="Running GIO applications">
17 <link rel="chapter" href="extending-gio.html" title="Extending GIO">
18 <link rel="part" href="pt02.html" title="Part II. API Reference">
19 <link rel="chapter" href="file_ops.html" title="File Operations">
20 <link rel="chapter" href="file_mon.html" title="File System Monitoring">
21 <link rel="chapter" href="async.html" title="Asynchronous I/O">
22 <link rel="chapter" href="conversion.html" title="Data conversion">
23 <link rel="chapter" href="streaming.html" title="Streaming I/O">
24 <link rel="chapter" href="types.html" title="File types and applications">
25 <link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
26 <link rel="chapter" href="icons.html" title="Icons">
27 <link rel="chapter" href="failable_initialization.html" title="Failable Initialization">
28 <link rel="chapter" href="networking.html" title="Lowlevel platform-independent network support">
29 <link rel="chapter" href="resolver.html" title="DNS resolution">
30 <link rel="chapter" href="highlevel-socket.html" title="Highlevel network functionallity">
31 <link rel="chapter" href="utils.html" title="Utilities">
32 <link rel="chapter" href="extending.html" title="Extending GIO">
33 <link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
34 <link rel="chapter" href="ch19.html" title="Migrating from POSIX to GIO">
35 <link rel="chapter" href="ch20.html" title="Migrating from GnomeVFS to GIO">
36 <link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
37 <link rel="index" href="api-index-full.html" title="Index">
38 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
39 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
40 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
41 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
42 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
44 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
45 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
47 <td><a accesskey="p" href="streaming.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
48 <td><a accesskey="u" href="streaming.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
49 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
50 <th width="100%" align="center">GIO Reference Manual</th>
51 <td><a accesskey="n" href="GInputStream.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
53 <tr><td colspan="5" class="shortcuts">
54 <a href="#GSeekable.synopsis" class="shortcut">Top</a>
56 <a href="#GSeekable.description" class="shortcut">Description</a>
58 <a href="#GSeekable.object-hierarchy" class="shortcut">Object Hierarchy</a>
60 <a href="#GSeekable.prerequisites" class="shortcut">Prerequisites</a>
62 <a href="#GSeekable.implementations" class="shortcut">Known Implementations</a>
65 <div class="refentry" title="GSeekable">
66 <a name="GSeekable"></a><div class="titlepage"></div>
67 <div class="refnamediv"><table width="100%"><tr>
69 <h2><span class="refentrytitle"><a name="GSeekable.top_of_page"></a>GSeekable</span></h2>
70 <p>GSeekable — Stream seeking interface</p>
72 <td valign="top" align="right"></td>
74 <div class="refsynopsisdiv" title="Synopsis">
75 <a name="GSeekable.synopsis"></a><h2>Synopsis</h2>
76 <pre class="synopsis">
77 #include <gio/gio.h>
79 <a class="link" href="GSeekable.html#GSeekable-struct" title="GSeekable">GSeekable</a>;
80 <a class="link" href="GSeekable.html#GSeekableIface" title="GSeekableIface">GSeekableIface</a>;
81 <a href="http://library.gnome.org/devel/glib/unstable/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> (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable);
82 <a href="http://library.gnome.org/devel/glib/unstable/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> (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable);
83 <a href="http://library.gnome.org/devel/glib/unstable/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> (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable,
84 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> offset,
85 <a href="http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#GSeekType"><span class="returnvalue">GSeekType</span></a> type,
86 <a class="link" href="GCancellable.html" title="GCancellable"><span class="returnvalue">GCancellable</span></a> *cancellable,
87 <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="returnvalue">GError</span></a> **error);
88 <a href="http://library.gnome.org/devel/glib/unstable/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> (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable);
89 <a href="http://library.gnome.org/devel/glib/unstable/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> (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable,
90 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> offset,
91 <a class="link" href="GCancellable.html" title="GCancellable"><span class="returnvalue">GCancellable</span></a> *cancellable,
92 <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="returnvalue">GError</span></a> **error);
95 <div class="refsect1" title="Object Hierarchy">
96 <a name="GSeekable.object-hierarchy"></a><h2>Object Hierarchy</h2>
97 <pre class="synopsis">
102 <div class="refsect1" title="Prerequisites">
103 <a name="GSeekable.prerequisites"></a><h2>Prerequisites</h2>
106 <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
108 <div class="refsect1" title="Known Implementations">
109 <a name="GSeekable.implementations"></a><h2>Known Implementations</h2>
111 GSeekable is implemented by
112 <a class="link" href="GFileOutputStream.html" title="GFileOutputStream">GFileOutputStream</a>, <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a>, <a class="link" href="GFileIOStream.html" title="GFileIOStream">GFileIOStream</a>, <a class="link" href="GMemoryInputStream.html" title="GMemoryInputStream">GMemoryInputStream</a> and <a class="link" href="GFileInputStream.html" title="GFileInputStream">GFileInputStream</a>.</p>
114 <div class="refsect1" title="Description">
115 <a name="GSeekable.description"></a><h2>Description</h2>
117 <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a> is implemented by streams (implementations of
118 <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.</p>
120 <div class="refsect1" title="Details">
121 <a name="GSeekable.details"></a><h2>Details</h2>
122 <div class="refsect2" title="GSeekable">
123 <a name="GSeekable-struct"></a><h3>GSeekable</h3>
124 <pre class="programlisting">typedef struct _GSeekable GSeekable;</pre>
126 Seek object for streaming operations.</p>
129 <div class="refsect2" title="GSeekableIface">
130 <a name="GSeekableIface"></a><h3>GSeekableIface</h3>
131 <pre class="programlisting">typedef struct {
132 GTypeInterface g_iface;
136 goffset (* tell) (GSeekable *seekable);
138 gboolean (* can_seek) (GSeekable *seekable);
139 gboolean (* seek) (GSeekable *seekable,
142 GCancellable *cancellable,
145 gboolean (* can_truncate) (GSeekable *seekable);
146 gboolean (* truncate_fn) (GSeekable *seekable,
148 GCancellable *cancellable,
151 /* TODO: Async seek/truncate */
155 Provides an interface for implementing seekable functionality on I/O Streams.</p>
156 <div class="variablelist"><table border="0">
157 <col align="left" valign="top">
160 <td><p><span class="term"><a href="http://library.gnome.org/devel/gobject/unstable/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>
161 <td> The parent interface.
165 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.tell"></a>tell</code></em> ()</span></p></td>
166 <td> Tells the current location within a stream.
170 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.can-seek"></a>can_seek</code></em> ()</span></p></td>
171 <td> Checks if seeking is supported by the stream.
175 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.seek"></a>seek</code></em> ()</span></p></td>
176 <td> Seeks to a location within a stream.
180 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.can-truncate"></a>can_truncate</code></em> ()</span></p></td>
181 <td> Chekcs if truncation is suppored by the stream.
185 <td><p><span class="term"><em class="structfield"><code><a name="GSeekableIface.truncate-fn"></a>truncate_fn</code></em> ()</span></p></td>
186 <td> Truncates a stream.
193 <div class="refsect2" title="g_seekable_tell ()">
194 <a name="g-seekable-tell"></a><h3>g_seekable_tell ()</h3>
195 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> g_seekable_tell (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable);</pre>
197 Tells the current position within the stream.</p>
198 <div class="variablelist"><table border="0">
199 <col align="left" valign="top">
202 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
203 <td> a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.
207 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
208 <td> the offset from the beginning of the buffer.
215 <div class="refsect2" title="g_seekable_can_seek ()">
216 <a name="g-seekable-can-seek"></a><h3>g_seekable_can_seek ()</h3>
217 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_can_seek (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable);</pre>
219 Tests if the stream supports the <a class="link" href="GSeekable.html#GSeekableIface" title="GSeekableIface"><span class="type">GSeekableIface</span></a>.</p>
220 <div class="variablelist"><table border="0">
221 <col align="left" valign="top">
224 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
225 <td> a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.
229 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
230 <td> <a href="http://library.gnome.org/devel/glib/unstable/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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.
237 <div class="refsect2" title="g_seekable_seek ()">
238 <a name="g-seekable-seek"></a><h3>g_seekable_seek ()</h3>
239 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_seek (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable,
240 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> offset,
241 <a href="http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#GSeekType"><span class="returnvalue">GSeekType</span></a> type,
242 <a class="link" href="GCancellable.html" title="GCancellable"><span class="returnvalue">GCancellable</span></a> *cancellable,
243 <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="returnvalue">GError</span></a> **error);</pre>
245 Seeks in the stream by the given <em class="parameter"><code>offset</code></em>, modified by <em class="parameter"><code>type</code></em>.
248 If <em class="parameter"><code>cancellable</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the operation can be cancelled by
249 triggering the cancellable object from another thread. If the operation
250 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.</p>
251 <div class="variablelist"><table border="0">
252 <col align="left" valign="top">
255 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
256 <td> a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.
260 <td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
261 <td> a <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a>.
265 <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
266 <td> a <a href="http://library.gnome.org/devel/glib/unstable/glib-IO-Channels.html#GSeekType"><span class="type">GSeekType</span></a>.
270 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
271 <td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.
275 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
276 <td> a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occuring, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
281 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
282 <td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful. If an error
283 has occurred, this function will return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
284 appropriately if present.
291 <div class="refsect2" title="g_seekable_can_truncate ()">
292 <a name="g-seekable-can-truncate"></a><h3>g_seekable_can_truncate ()</h3>
293 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_can_truncate (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable);</pre>
295 Tests if the stream can be truncated.</p>
296 <div class="variablelist"><table border="0">
297 <col align="left" valign="top">
300 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
301 <td> a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.
305 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
306 <td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the stream can be truncated, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.
313 <div class="refsect2" title="g_seekable_truncate ()">
314 <a name="g-seekable-truncate"></a><h3>g_seekable_truncate ()</h3>
315 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_seekable_truncate (<a class="link" href="GSeekable.html" title="GSeekable"><span class="returnvalue">GSeekable</span></a> *seekable,
316 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="returnvalue">goffset</span></a> offset,
317 <a class="link" href="GCancellable.html" title="GCancellable"><span class="returnvalue">GCancellable</span></a> *cancellable,
318 <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="returnvalue">GError</span></a> **error);</pre>
320 Truncates a stream with a given <span class="type">offset</span>.
323 If <em class="parameter"><code>cancellable</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the operation can be cancelled by
324 triggering the cancellable object from another thread. If the operation
325 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
326 operation was partially finished when the operation was cancelled the
327 partial result will be returned, without an error.</p>
328 <div class="variablelist"><table border="0">
329 <col align="left" valign="top">
332 <td><p><span class="term"><em class="parameter"><code>seekable</code></em> :</span></p></td>
333 <td> a <a class="link" href="GSeekable.html" title="GSeekable"><span class="type">GSeekable</span></a>.
337 <td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
338 <td> a <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#goffset"><span class="type">goffset</span></a>.
342 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
343 <td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.
347 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
348 <td> a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occuring, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
353 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
354 <td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful. If an error
355 has occurred, this function will return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
356 appropriately if present.
363 <div class="refsect1" title="See Also">
364 <a name="GSeekable.see-also"></a><h2>See Also</h2>
365 <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>
370 Generated by GTK-Doc V1.13</div>