1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GInputStream</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="GIO Reference Manual">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
7
<link rel="home" href="index.html" title="GIO Reference Manual">
8
8
<link rel="up" href="streaming.html" title="Streaming I/O">
9
9
<link rel="prev" href="GSeekable.html" title="GSeekable">
10
10
<link rel="next" href="GOutputStream.html" title="GOutputStream">
11
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
13
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
14
14
<link rel="chapter" href="ch01.html" title="Introduction">
15
15
<link rel="chapter" href="ch02.html" title="Compiling GIO applications">
16
16
<link rel="chapter" href="ch03.html" title="Running GIO applications">
17
<link rel="chapter" href="gio-extension-points.html" title="Extending GIO">
18
<link rel="part" href="pt02.html" title="Part II. API Reference">
17
<link rel="chapter" href="extending-gio.html" title="Extending GIO">
18
<link rel="part" href="pt02.html" title="Part II. API Reference">
19
19
<link rel="chapter" href="file_ops.html" title="File Operations">
20
20
<link rel="chapter" href="file_mon.html" title="File System Monitoring">
21
21
<link rel="chapter" href="async.html" title="Asynchronous I/O">
40
41
<th width="100%" align="center">GIO Reference Manual</th>
41
42
<td><a accesskey="n" href="GOutputStream.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
43
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2779002" class="shortcut">Top</a>
45
<a href="#id2843054" class="shortcut">Description</a>
47
<a href="#id2843005" class="shortcut">Object Hierarchy</a></nobr></td></tr>
44
<tr><td colspan="5" class="shortcuts">
45
<a href="#GInputStream.synopsis" class="shortcut">Top</a>
47
<a href="#GInputStream.description" class="shortcut">Description</a>
49
<a href="#GInputStream.object-hierarchy" class="shortcut">Object Hierarchy</a>
49
52
<div class="refentry" lang="en">
50
53
<a name="GInputStream"></a><div class="titlepage"></div>
51
54
<div class="refnamediv"><table width="100%"><tr>
54
<a name="id2779002"></a><span class="refentrytitle">GInputStream</span>
56
<p>GInputStream — Base class for implementing streaming input</p>
56
<h2><span class="refentrytitle"><a name="GInputStream.top_of_page"></a>GInputStream</span></h2>
57
<p>GInputStream — Base class for implementing streaming input</p>
58
59
<td valign="top" align="right"></td>
59
60
</tr></table></div>
60
61
<div class="refsynopsisdiv">
62
<a name="GInputStream.synopsis"></a><h2>Synopsis</h2>
62
63
<pre class="synopsis">
64
65
#include <gio/gio.h>
67
<a class="link" href="GInputStream.html#GInputStream-struct">GInputStream</a>;
67
<a class="link" href="GInputStream.html#GInputStream-struct" title="GInputStream">GInputStream</a>;
69
69
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gssize"
70
>gssize</a> <a class="link" href="GInputStream.html#g-input-stream-read">g_input_stream_read</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
70
>gssize</a> <a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()">g_input_stream_read</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
73
73
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
102
102
>GError</a> **error);
104
104
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
105
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-close">g_input_stream_close</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
105
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-close" title="g_input_stream_close ()">g_input_stream_close</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
106
106
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
108
108
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
109
109
>GError</a> **error);
110
void <a class="link" href="GInputStream.html#g-input-stream-read-async">g_input_stream_read_async</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
110
void <a class="link" href="GInputStream.html#g-input-stream-read-async" title="g_input_stream_read_async ()">g_input_stream_read_async</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
113
113
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
114
114
>gsize</a> count,
116
116
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
117
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback,
117
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">GAsyncReadyCallback</a> callback,
119
119
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
120
120
>gpointer</a> user_data);
122
122
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gssize"
123
>gssize</a> <a class="link" href="GInputStream.html#g-input-stream-read-finish">g_input_stream_read_finish</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
123
>gssize</a> <a class="link" href="GInputStream.html#g-input-stream-read-finish" title="g_input_stream_read_finish ()">g_input_stream_read_finish</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
124
124
<a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *result,
126
126
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
127
127
>GError</a> **error);
128
void <a class="link" href="GInputStream.html#g-input-stream-skip-async">g_input_stream_skip_async</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
128
void <a class="link" href="GInputStream.html#g-input-stream-skip-async" title="g_input_stream_skip_async ()">g_input_stream_skip_async</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
130
130
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
131
131
>gsize</a> count,
133
133
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
134
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback,
134
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">GAsyncReadyCallback</a> callback,
136
136
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
137
137
>gpointer</a> user_data);
139
139
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gssize"
140
>gssize</a> <a class="link" href="GInputStream.html#g-input-stream-skip-finish">g_input_stream_skip_finish</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
140
>gssize</a> <a class="link" href="GInputStream.html#g-input-stream-skip-finish" title="g_input_stream_skip_finish ()">g_input_stream_skip_finish</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
141
141
<a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *result,
143
143
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
144
144
>GError</a> **error);
145
void <a class="link" href="GInputStream.html#g-input-stream-close-async">g_input_stream_close_async</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
145
void <a class="link" href="GInputStream.html#g-input-stream-close-async" title="g_input_stream_close_async ()">g_input_stream_close_async</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
147
147
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
148
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback,
148
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">GAsyncReadyCallback</a> callback,
150
150
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
151
151
>gpointer</a> user_data);
153
153
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
154
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-close-finish">g_input_stream_close_finish</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
154
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-close-finish" title="g_input_stream_close_finish ()">g_input_stream_close_finish</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
155
155
<a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *result,
157
157
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
158
158
>GError</a> **error);
160
160
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
161
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-is-closed">g_input_stream_is_closed</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream);
163
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
164
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-has-pending">g_input_stream_has_pending</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream);
166
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
167
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-set-pending">g_input_stream_set_pending</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
161
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-is-closed" title="g_input_stream_is_closed ()">g_input_stream_is_closed</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream);
163
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
164
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-has-pending" title="g_input_stream_has_pending ()">g_input_stream_has_pending</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream);
166
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
167
>gboolean</a> <a class="link" href="GInputStream.html#g-input-stream-set-pending" title="g_input_stream_set_pending ()">g_input_stream_set_pending</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
169
169
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
170
170
>GError</a> **error);
171
void <a class="link" href="GInputStream.html#g-input-stream-clear-pending">g_input_stream_clear_pending</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream);
171
void <a class="link" href="GInputStream.html#g-input-stream-clear-pending" title="g_input_stream_clear_pending ()">g_input_stream_clear_pending</a> (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream);
176
174
<div class="refsect1" lang="en">
177
<a name="id2843005"></a><h2>Object Hierarchy</h2>
175
<a name="GInputStream.object-hierarchy"></a><h2>Object Hierarchy</h2>
178
176
<pre class="synopsis">
181
178
href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject"
183
180
+----GInputStream
184
+----<a class="link" href="GUnixInputStream.html" title="GUnixInputStream">GUnixInputStream</a>
185
+----<a class="link" href="GMemoryInputStream.html" title="GMemoryInputStream">GMemoryInputStream</a>
186
181
+----<a class="link" href="GFilterInputStream.html" title="GFilterInputStream">GFilterInputStream</a>
187
182
+----<a class="link" href="GFileInputStream.html" title="GFileInputStream">GFileInputStream</a>
183
+----<a class="link" href="GMemoryInputStream.html" title="GMemoryInputStream">GMemoryInputStream</a>
184
+----<a class="link" href="GUnixInputStream.html" title="GUnixInputStream">GUnixInputStream</a>
190
187
<div class="refsect1" lang="en">
191
<a name="id2843054"></a><h2>Description</h2>
188
<a name="GInputStream.description"></a><h2>Description</h2>
190
GInputStream has functions to read from a stream (<a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()"><code class="function">g_input_stream_read()</code></a>),
191
to close a stream (<a class="link" href="GInputStream.html#g-input-stream-close" title="g_input_stream_close ()"><code class="function">g_input_stream_close()</code></a>) and to skip some content
192
(<a class="link" href="GInputStream.html#g-input-stream-skip" title="g_input_stream_skip ()"><code class="function">g_input_stream_skip()</code></a>).
195
To copy the content of an input stream to an output stream without
196
manually handling the reads and writes, use <a class="link" href="GOutputStream.html#g-output-stream-splice" title="g_output_stream_splice ()"><code class="function">g_output_stream_splice()</code></a>.
199
All of these functions have async variants too.</p>
198
203
<div class="refsect1" lang="en">
199
<a name="id2843074"></a><h2>Details</h2>
204
<a name="GInputStream.details"></a><h2>Details</h2>
200
205
<div class="refsect2" lang="en">
201
<a name="id2843084"></a><h3>
202
<a name="GInputStream-struct"></a>GInputStream</h3>
203
<a class="indexterm" name="id2843097"></a><pre class="programlisting">typedef struct _GInputStream GInputStream;</pre>
206
<a name="GInputStream-struct"></a><h3>GInputStream</h3>
207
<pre class="programlisting">typedef struct _GInputStream GInputStream;</pre>
205
209
Base class for streaming input operations.</p>
211
214
<div class="refsect2" lang="en">
212
<a name="id2843116"></a><h3>
213
<a name="g-input-stream-read"></a>g_input_stream_read ()</h3>
214
<a class="indexterm" name="id2849193"></a><pre class="programlisting"><a
215
<a name="g-input-stream-read"></a><h3>g_input_stream_read ()</h3>
216
<pre class="programlisting"><a
215
217
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gssize"
216
218
>gssize</a> g_input_stream_read (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
249
251
On error -1 is returned and <em class="parameter"><code>error</code></em> is set accordingly.</p>
253
254
<div class="variablelist"><table border="0">
254
255
<col align="left" valign="top">
257
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
258
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
258
259
<td> a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
262
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
263
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
263
264
<td> a buffer to read data into (which should be at least count bytes long).
267
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
268
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
268
269
<td> the number of bytes that will be read from the stream
272
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
273
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
273
274
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
274
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
275
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
275
276
><code class="literal">NULL</code></a> to ignore.
279
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
280
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
280
281
<td> location to store the error occuring, or <a
281
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
282
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
282
283
><code class="literal">NULL</code></a> to ignore
286
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
287
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
287
288
<td> Number of bytes read, or -1 on error
313
313
<em class="parameter"><code>buffer</code></em>. Will block during this read.
316
This function is similar to <a class="link" href="GInputStream.html#g-input-stream-read"><code class="function">g_input_stream_read()</code></a>, except it tries to
316
This function is similar to <a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()"><code class="function">g_input_stream_read()</code></a>, except it tries to
317
317
read as many bytes as requested, only stopping on an error or end of stream.
320
320
On a successful read of <em class="parameter"><code>count</code></em> bytes, or if we reached the end of the
322
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
322
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
323
323
><code class="literal">TRUE</code></a> is returned, and <em class="parameter"><code>bytes_read</code></em> is set to the number of bytes
324
324
read into <em class="parameter"><code>buffer</code></em>.
327
327
If there is an error during the operation <a
328
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"
328
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
329
329
><code class="literal">FALSE</code></a> is returned and <em class="parameter"><code>error</code></em>
330
330
is set to indicate the error status, <em class="parameter"><code>bytes_read</code></em> is updated to contain
331
331
the number of bytes read into <em class="parameter"><code>buffer</code></em> before the error occurred.</p>
335
334
<div class="variablelist"><table border="0">
336
335
<col align="left" valign="top">
339
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
338
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
340
339
<td> a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
344
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
343
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
345
344
<td> a buffer to read data into (which should be at least count bytes long).
349
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
348
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
350
349
<td> the number of bytes that will be read from the stream
354
<td><p><span class="term"><em class="parameter"><code>bytes_read</code></em> :</span></p></td>
353
<td><p><span class="term"><em class="parameter"><code>bytes_read</code></em> :</span></p></td>
355
354
<td> location to store the number of bytes that was read from the stream
359
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
358
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
360
359
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
361
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
360
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
362
361
><code class="literal">NULL</code></a> to ignore.
366
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
365
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
367
366
<td> location to store the error occuring, or <a
368
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
367
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
369
368
><code class="literal">NULL</code></a> to ignore
373
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
372
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
375
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
374
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
376
375
><code class="literal">TRUE</code></a> on success, <a
377
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"
376
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
378
377
><code class="literal">FALSE</code></a> if there was an error
411
409
If <em class="parameter"><code>cancellable</code></em> is not <a
412
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
410
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
413
411
><code class="literal">NULL</code></a>, then the operation can be cancelled by
414
412
triggering the cancellable object from another thread. If the operation
415
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
413
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
416
414
operation was partially finished when the operation was cancelled the
417
415
partial result will be returned, without an error.</p>
421
418
<div class="variablelist"><table border="0">
422
419
<col align="left" valign="top">
425
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
422
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
426
423
<td> a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
430
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
427
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
431
428
<td> the number of bytes that will be skipped from the stream
435
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
432
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
436
433
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
437
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
434
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
438
435
><code class="literal">NULL</code></a> to ignore.
442
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
439
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
443
440
<td> location to store the error occuring, or <a
444
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
441
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
445
442
><code class="literal">NULL</code></a> to ignore
449
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
446
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
450
447
<td> Number of bytes skipped, or -1 on error
485
481
On failure the first error that happened will be reported, but the close
486
482
operation will finish as much as possible. A stream that failed to
487
close will still return <a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a> for all operations. Still, it
483
close will still return <a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED--CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a> for all operations. Still, it
488
484
is important to check and report the error to the user.
491
487
If <em class="parameter"><code>cancellable</code></em> is not NULL, then the operation can be cancelled by
492
488
triggering the cancellable object from another thread. If the operation
493
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.
489
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.
494
490
Cancelling a close will still leave the stream closed, but some streams
495
491
can use a faster close that doesn't block to e.g. check errors.</p>
499
494
<div class="variablelist"><table border="0">
500
495
<col align="left" valign="top">
503
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
498
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
504
499
<td> A <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
508
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
503
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
509
504
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
510
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
505
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
511
506
><code class="literal">NULL</code></a> to ignore.
515
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
510
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
516
511
<td> location to store the error occuring, or <a
517
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
512
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
518
513
><code class="literal">NULL</code></a> to ignore
522
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
517
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
524
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
519
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
525
520
><code class="literal">TRUE</code></a> on success, <a
526
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"
521
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
527
522
><code class="literal">FALSE</code></a> on failure
534
529
<div class="refsect2" lang="en">
535
<a name="id2850242"></a><h3>
536
<a name="g-input-stream-read-async"></a>g_input_stream_read_async ()</h3>
537
<a class="indexterm" name="id2850253"></a><pre class="programlisting">void g_input_stream_read_async (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
530
<a name="g-input-stream-read-async"></a><h3>g_input_stream_read_async ()</h3>
531
<pre class="programlisting">void g_input_stream_read_async (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
540
534
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
541
535
>gsize</a> count,
543
537
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
544
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback,
538
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">GAsyncReadyCallback</a> callback,
546
540
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
547
541
>gpointer</a> user_data);</pre>
549
543
Request an asynchronous read of <em class="parameter"><code>count</code></em> bytes from the stream into the buffer
550
544
starting at <em class="parameter"><code>buffer</code></em>. When the operation is finished <em class="parameter"><code>callback</code></em> will be called.
551
You can then call <a class="link" href="GInputStream.html#g-input-stream-read-finish"><code class="function">g_input_stream_read_finish()</code></a> to get the result of the
545
You can then call <a class="link" href="GInputStream.html#g-input-stream-read-finish" title="g_input_stream_read_finish ()"><code class="function">g_input_stream_read_finish()</code></a> to get the result of the
555
549
During an async request no other sync and async calls are allowed, and will
556
result in <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING:CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> errors.
550
result in <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING--CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> errors.
559
553
A value of <em class="parameter"><code>count</code></em> larger than <a
560
href="/usr/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html#G-MAXSSIZE:CAPS"
561
><code class="literal">G_MAXSSIZE</code></a> will cause a <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a> error.
554
href="/usr/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html#G-MAXSSIZE--CAPS"
555
><code class="literal">G_MAXSSIZE</code></a> will cause a <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT--CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a> error.
564
558
On success, the number of bytes read into the buffer will be passed to the
579
573
asynchronicity, so they are optional for inheriting classes. However, if you
580
574
override one you must override all.</p>
584
577
<div class="variablelist"><table border="0">
585
578
<col align="left" valign="top">
588
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
581
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
589
582
<td> A <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
593
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
586
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
594
587
<td> a buffer to read data into (which should be at least count bytes long).
598
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
591
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
599
592
<td> the number of bytes that will be read from the stream
603
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
596
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
604
597
<td> the <a class="link" href="gio-GIOScheduler.html#io-priority">I/O priority</a>
609
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
602
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
610
603
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
611
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
604
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
612
605
><code class="literal">NULL</code></a> to ignore.
616
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
609
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
617
610
<td> callback to call when the request is satisfied
621
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
614
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
622
615
<td> the data to pass to callback function
676
667
<div class="refsect2" lang="en">
677
<a name="id2850720"></a><h3>
678
<a name="g-input-stream-skip-async"></a>g_input_stream_skip_async ()</h3>
679
<a class="indexterm" name="id2850732"></a><pre class="programlisting">void g_input_stream_skip_async (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
668
<a name="g-input-stream-skip-async"></a><h3>g_input_stream_skip_async ()</h3>
669
<pre class="programlisting">void g_input_stream_skip_async (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
681
671
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
682
672
>gsize</a> count,
684
674
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
685
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback,
675
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">GAsyncReadyCallback</a> callback,
687
677
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
688
678
>gpointer</a> user_data);</pre>
690
680
Request an asynchronous skip of <em class="parameter"><code>count</code></em> bytes from the stream into the buffer
691
681
starting at <em class="parameter"><code>buffer</code></em>. When the operation is finished <em class="parameter"><code>callback</code></em> will be called.
692
You can then call <a class="link" href="GInputStream.html#g-input-stream-skip-finish"><code class="function">g_input_stream_skip_finish()</code></a> to get the result of the
682
You can then call <a class="link" href="GInputStream.html#g-input-stream-skip-finish" title="g_input_stream_skip_finish ()"><code class="function">g_input_stream_skip_finish()</code></a> to get the result of the
696
686
During an async request no other sync and async calls are allowed, and will
697
result in <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING:CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> errors.
687
result in <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING--CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> errors.
700
690
A value of <em class="parameter"><code>count</code></em> larger than <a
701
href="/usr/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html#G-MAXSSIZE:CAPS"
702
><code class="literal">G_MAXSSIZE</code></a> will cause a <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a> error.
691
href="/usr/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html#G-MAXSSIZE--CAPS"
692
><code class="literal">G_MAXSSIZE</code></a> will cause a <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT--CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a> error.
705
695
On success, the number of bytes skipped will be passed to the
720
710
asynchronicity, so they are optional for inheriting classes. However, if you
721
711
override one you must override all.</p>
725
714
<div class="variablelist"><table border="0">
726
715
<col align="left" valign="top">
729
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
718
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
730
719
<td> A <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
734
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
723
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
735
724
<td> the number of bytes that will be skipped from the stream
739
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
728
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
740
729
<td> the <a class="link" href="gio-GIOScheduler.html#io-priority">I/O priority</a>
745
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
734
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
746
735
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
747
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
736
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
748
737
><code class="literal">NULL</code></a> to ignore.
752
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
741
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
753
742
<td> callback to call when the request is satisfied
757
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
746
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
758
747
<td> the data to pass to callback function
812
799
<div class="refsect2" lang="en">
813
<a name="id2851188"></a><h3>
814
<a name="g-input-stream-close-async"></a>g_input_stream_close_async ()</h3>
815
<a class="indexterm" name="id2851200"></a><pre class="programlisting">void g_input_stream_close_async (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
800
<a name="g-input-stream-close-async"></a><h3>g_input_stream_close_async ()</h3>
801
<pre class="programlisting">void g_input_stream_close_async (<a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a> *stream,
817
803
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
818
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback,
804
<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">GAsyncReadyCallback</a> callback,
820
806
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
821
807
>gpointer</a> user_data);</pre>
823
809
Requests an asynchronous closes of the stream, releasing resources related to it.
824
810
When the operation is finished <em class="parameter"><code>callback</code></em> will be called.
825
You can then call <a class="link" href="GInputStream.html#g-input-stream-close-finish"><code class="function">g_input_stream_close_finish()</code></a> to get the result of the
811
You can then call <a class="link" href="GInputStream.html#g-input-stream-close-finish" title="g_input_stream_close_finish ()"><code class="function">g_input_stream_close_finish()</code></a> to get the result of the
829
For behaviour details see <a class="link" href="GInputStream.html#g-input-stream-close"><code class="function">g_input_stream_close()</code></a>.
815
For behaviour details see <a class="link" href="GInputStream.html#g-input-stream-close" title="g_input_stream_close ()"><code class="function">g_input_stream_close()</code></a>.
832
818
The asyncronous methods have a default fallback that uses threads to implement
833
819
asynchronicity, so they are optional for inheriting classes. However, if you
834
820
override one you must override all.</p>
838
823
<div class="variablelist"><table border="0">
839
824
<col align="left" valign="top">
842
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
827
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
843
828
<td> A <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
847
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
832
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
848
833
<td> the <a class="link" href="gio-GIOScheduler.html#io-priority">I/O priority</a>
853
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
838
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
854
839
<td> optional cancellable object
858
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
843
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
859
844
<td> callback to call when the request is satisfied
863
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
848
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
864
849
<td> the data to pass to callback function
879
863
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
880
864
>GError</a> **error);</pre>
882
Finishes closing a stream asynchronously, started from <a class="link" href="GInputStream.html#g-input-stream-close-async"><code class="function">g_input_stream_close_async()</code></a>.</p>
866
Finishes closing a stream asynchronously, started from <a class="link" href="GInputStream.html#g-input-stream-close-async" title="g_input_stream_close_async ()"><code class="function">g_input_stream_close_async()</code></a>.</p>
886
869
<div class="variablelist"><table border="0">
887
870
<col align="left" valign="top">
890
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
873
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
891
874
<td> a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.
895
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
878
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
896
879
<td> a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.
900
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
883
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
902
885
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
903
886
><span class="type">GError</span></a> location to store the error occuring, or <a
904
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
887
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
905
888
><code class="literal">NULL</code></a> to
910
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
893
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
912
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
895
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
913
896
><code class="literal">TRUE</code></a> if the stream was closed successfully.
990
968
Sets <em class="parameter"><code>stream</code></em> to have actions pending. If the pending flag is
991
969
already set or <em class="parameter"><code>stream</code></em> is closed, it will return <a
992
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"
970
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
993
971
><code class="literal">FALSE</code></a> and set
994
972
<em class="parameter"><code>error</code></em>.</p>
998
975
<div class="variablelist"><table border="0">
999
976
<col align="left" valign="top">
1002
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
979
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
1003
980
<td> input stream
1007
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
984
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1009
986
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
1010
987
><span class="type">GError</span></a> location to store the error occuring, or <a
1011
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
988
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
1012
989
><code class="literal">NULL</code></a> to
1017
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
994
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1019
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
996
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
1020
997
><code class="literal">TRUE</code></a> if pending was previously unset and is now set.