Moving files to packaging and extracing new tarball.
[profile/ivi/glib2.git] / docs / reference / gio / html / GSeekable.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
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">
13 </head>
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">
16 <tr valign="middle">
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>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#GSeekable.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#GSeekable.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#GSeekable.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#GSeekable.prerequisites" class="shortcut">Prerequisites</a>
31                    | 
32                   <a href="#GSeekable.implementations" class="shortcut">Known Implementations</a>
33 </td></tr>
34 </table>
35 <div class="refentry">
36 <a name="GSeekable"></a><div class="titlepage"></div>
37 <div class="refnamediv"><table width="100%"><tr>
38 <td valign="top">
39 <h2><span class="refentrytitle"><a name="GSeekable.top_of_page"></a>GSeekable</span></h2>
40 <p>GSeekable — Stream seeking interface</p>
41 </td>
42 <td valign="top" align="right"></td>
43 </tr></table></div>
44 <div class="refsynopsisdiv">
45 <a name="GSeekable.synopsis"></a><h2>Synopsis</h2>
46 <pre class="synopsis">
47 #include &lt;gio/gio.h&gt;
48
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>);
63 </pre>
64 </div>
65 <div class="refsect1">
66 <a name="GSeekable.object-hierarchy"></a><h2>Object Hierarchy</h2>
67 <pre class="synopsis">
68   GInterface
69    +----GSeekable
70 </pre>
71 </div>
72 <div class="refsect1">
73 <a name="GSeekable.prerequisites"></a><h2>Prerequisites</h2>
74 <p>
75 GSeekable requires
76  <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
77 </div>
78 <div class="refsect1">
79 <a name="GSeekable.implementations"></a><h2>Known Implementations</h2>
80 <p>
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>
83 </div>
84 <div class="refsect1">
85 <a name="GSeekable.description"></a><h2>Description</h2>
86 <p>
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.
89 </p>
90 </div>
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>
96 <p>
97 Seek object for streaming operations.
98 </p>
99 </div>
100 <hr>
101 <div class="refsect2">
102 <a name="GSeekableIface"></a><h3>struct GSeekableIface</h3>
103 <pre class="programlisting">struct GSeekableIface {
104   GTypeInterface g_iface;
105
106   /* Virtual Table */
107
108   goffset     (* tell)           (GSeekable    *seekable);
109
110   gboolean    (* can_seek)       (GSeekable    *seekable);
111   gboolean    (* seek)           (GSeekable    *seekable,
112                                   goffset       offset,
113                                   GSeekType     type,
114                                   GCancellable *cancellable,
115                                   GError      **error);
116
117   gboolean    (* can_truncate)   (GSeekable    *seekable);
118   gboolean    (* truncate_fn)    (GSeekable    *seekable,
119                                   goffset       offset,
120                                   GCancellable *cancellable,
121                                   GError       **error);
122
123   /* TODO: Async seek/truncate */
124 };
125 </pre>
126 <p>
127 Provides an interface for implementing seekable functionality on I/O Streams.
128 </p>
129 <div class="variablelist"><table border="0">
130 <col align="left" valign="top">
131 <tbody>
132 <tr>
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>
135 </tr>
136 <tr>
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>
139 </tr>
140 <tr>
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>
143 </tr>
144 <tr>
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>
147 </tr>
148 <tr>
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>
151 </tr>
152 <tr>
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>
155 </tr>
156 </tbody>
157 </table></div>
158 </div>
159 <hr>
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>
163 <p>
164 Tells the current position within the stream.
165 </p>
166 <div class="variablelist"><table border="0">
167 <col align="left" valign="top">
168 <tbody>
169 <tr>
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>
172 </tr>
173 <tr>
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>
176 </tr>
177 </tbody>
178 </table></div>
179 </div>
180 <hr>
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>
184 <p>
185 Tests if the stream supports the <a class="link" href="GSeekable.html#GSeekableIface" title="struct GSeekableIface"><span class="type">GSeekableIface</span></a>.
186 </p>
187 <div class="variablelist"><table border="0">
188 <col align="left" valign="top">
189 <tbody>
190 <tr>
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>
193 </tr>
194 <tr>
195 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
196 <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>
198 </tr>
199 </tbody>
200 </table></div>
201 </div>
202 <hr>
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>
210 <p>
211 Seeks in the stream by the given <em class="parameter"><code>offset</code></em>, modified by <em class="parameter"><code>type</code></em>.
212 </p>
213 <p>
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.
217 </p>
218 <div class="variablelist"><table border="0">
219 <col align="left" valign="top">
220 <tbody>
221 <tr>
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>
224 </tr>
225 <tr>
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>
228 </tr>
229 <tr>
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>
232 </tr>
233 <tr>
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>
236 </td>
237 </tr>
238 <tr>
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
241 ignore.</td>
242 </tr>
243 <tr>
244 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
245 <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>
249 </tr>
250 </tbody>
251 </table></div>
252 </div>
253 <hr>
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>
257 <p>
258 Tests if the stream can be truncated.
259 </p>
260 <div class="variablelist"><table border="0">
261 <col align="left" valign="top">
262 <tbody>
263 <tr>
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>
266 </tr>
267 <tr>
268 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
269 <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>
271 </tr>
272 </tbody>
273 </table></div>
274 </div>
275 <hr>
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>
282 <p>
283 Truncates a stream with a given <span class="type">offset</span>. 
284 </p>
285 <p>
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.
291 </p>
292 <p>
293 Virtual: truncate_fn
294 </p>
295 <div class="variablelist"><table border="0">
296 <col align="left" valign="top">
297 <tbody>
298 <tr>
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>
301 </tr>
302 <tr>
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>
305 </tr>
306 <tr>
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>
309 </td>
310 </tr>
311 <tr>
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
314 ignore.</td>
315 </tr>
316 <tr>
317 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
318 <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>
322 </tr>
323 </tbody>
324 </table></div>
325 </div>
326 </div>
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>
330 </div>
331 </div>
332 <div class="footer">
333 <hr>
334           Generated by GTK-Doc V1.18</div>
335 </body>
336 </html>