⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.10
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
gtk-doc
/
html
/
gio
/
View File Name :
GOutputStream.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>GOutputStream: GIO Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="GIO Reference Manual"> <link rel="up" href="streaming.html" title="Streaming I/O"> <link rel="prev" href="GInputStream.html" title="GInputStream"> <link rel="next" href="GIOStream.html" title="GIOStream"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#GOutputStream.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> <a href="#GOutputStream.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_derived_interfaces"> <span class="dim">|</span> <a href="#GOutputStream.derived-interfaces" class="shortcut">Known Derived Interfaces</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="streaming.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="GInputStream.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="GIOStream.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="GOutputStream"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="GOutputStream.top_of_page"></a>GOutputStream</span></h2> <p>GOutputStream — Base class for implementing streaming output</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="GOutputStream.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_proto_type"> <col class="functions_proto_name"> </colgroup> <tbody> <tr> <td class="function_type"> <span class="returnvalue">gssize</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()">g_output_stream_write</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()">g_output_stream_write_all</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-all-async" title="g_output_stream_write_all_async ()">g_output_stream_write_all_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-all-finish" title="g_output_stream_write_all_finish ()">g_output_stream_write_all_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-writev" title="g_output_stream_writev ()">g_output_stream_writev</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-writev-all" title="g_output_stream_writev_all ()">g_output_stream_writev_all</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-writev-async" title="g_output_stream_writev_async ()">g_output_stream_writev_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-writev-finish" title="g_output_stream_writev_finish ()">g_output_stream_writev_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-writev-all-async" title="g_output_stream_writev_all_async ()">g_output_stream_writev_all_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-writev-all-finish" title="g_output_stream_writev_all_finish ()">g_output_stream_writev_all_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gssize</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-splice" title="g_output_stream_splice ()">g_output_stream_splice</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-flush" title="g_output_stream_flush ()">g_output_stream_flush</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-close" title="g_output_stream_close ()">g_output_stream_close</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-async" title="g_output_stream_write_async ()">g_output_stream_write_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gssize</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-finish" title="g_output_stream_write_finish ()">g_output_stream_write_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-splice-async" title="g_output_stream_splice_async ()">g_output_stream_splice_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gssize</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-splice-finish" title="g_output_stream_splice_finish ()">g_output_stream_splice_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-flush-async" title="g_output_stream_flush_async ()">g_output_stream_flush_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-flush-finish" title="g_output_stream_flush_finish ()">g_output_stream_flush_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-close-async" title="g_output_stream_close_async ()">g_output_stream_close_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-close-finish" title="g_output_stream_close_finish ()">g_output_stream_close_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-is-closing" title="g_output_stream_is_closing ()">g_output_stream_is_closing</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-is-closed" title="g_output_stream_is_closed ()">g_output_stream_is_closed</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-has-pending" title="g_output_stream_has_pending ()">g_output_stream_has_pending</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-set-pending" title="g_output_stream_set_pending ()">g_output_stream_set_pending</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-clear-pending" title="g_output_stream_clear_pending ()">g_output_stream_clear_pending</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gssize</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-bytes" title="g_output_stream_write_bytes ()">g_output_stream_write_bytes</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-bytes-async" title="g_output_stream_write_bytes_async ()">g_output_stream_write_bytes_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gssize</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-write-bytes-finish" title="g_output_stream_write_bytes_finish ()">g_output_stream_write_bytes_finish</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-printf" title="g_output_stream_printf ()">g_output_stream_printf</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GOutputStream.html#g-output-stream-vprintf" title="g_output_stream_vprintf ()">g_output_stream_vprintf</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="GOutputStream.other"></a><h2>Types and Values</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="other_proto_type"> <col class="other_proto_name"> </colgroup> <tbody> <tr> <td class="datatype_keyword">enum</td> <td class="function_name"><a class="link" href="GOutputStream.html#GOutputStreamSpliceFlags" title="enum GOutputStreamSpliceFlags">GOutputStreamSpliceFlags</a></td> </tr> <tr> <td class="datatype_keyword"> </td> <td class="function_name"><a class="link" href="GOutputStream.html#GOutputStream-struct" title="GOutputStream">GOutputStream</a></td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="GOutputStream.object-hierarchy"></a><h2>Object Hierarchy</h2> <pre class="screen"> GFlags <span class="lineart">╰──</span> GOutputStreamSpliceFlags GObject <span class="lineart">╰──</span> GOutputStream <span class="lineart">├──</span> <a class="link" href="GFilterOutputStream.html" title="GFilterOutputStream">GFilterOutputStream</a> <span class="lineart">├──</span> <a class="link" href="GFileOutputStream.html" title="GFileOutputStream">GFileOutputStream</a> <span class="lineart">├──</span> <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> <span class="lineart">╰──</span> <a class="link" href="GUnixOutputStream.html" title="GUnixOutputStream">GUnixOutputStream</a> </pre> </div> <div class="refsect1"> <a name="GOutputStream.derived-interfaces"></a><h2>Known Derived Interfaces</h2> <p> GOutputStream is required by <a class="link" href="GPollableOutputStream.html" title="GPollableOutputStream">GPollableOutputStream</a>.</p> </div> <div class="refsect1"> <a name="GOutputStream.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <gio/gio.h> </pre> </div> <div class="refsect1"> <a name="GOutputStream.description"></a><h2>Description</h2> <p><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> has functions to write to a stream (<a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a>), to close a stream (<a class="link" href="GOutputStream.html#g-output-stream-close" title="g_output_stream_close ()"><code class="function">g_output_stream_close()</code></a>) and to flush pending writes (<a class="link" href="GOutputStream.html#g-output-stream-flush" title="g_output_stream_flush ()"><code class="function">g_output_stream_flush()</code></a>). </p> <p>To copy the content of an input stream to an output stream without 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>.</p> <p>See the documentation for <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> for details of thread safety of streaming APIs.</p> <p>All of these functions have async variants too.</p> </div> <div class="refsect1"> <a name="GOutputStream.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="g-output-stream-write"></a><h3>g_output_stream_write ()</h3> <pre class="programlisting"><span class="returnvalue">gssize</span> g_output_stream_write (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <span class="type">void</span> *buffer</code></em>, <em class="parameter"><code><span class="type">gsize</span> count</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Tries to write <em class="parameter"><code>count</code></em> bytes from <em class="parameter"><code>buffer</code></em> into the stream. Will block during the operation.</p> <p>If count is 0, returns 0 and does nothing. A value of <em class="parameter"><code>count</code></em> larger than <code class="literal">G_MAXSSIZE</code> 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.</p> <p>On success, the number of bytes written to the stream is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, or if there is not enough storage in the stream. All writes block until at least one byte is written or an error occurs; 0 is never returned (unless <em class="parameter"><code>count</code></em> is 0).</p> <p>If <em class="parameter"><code>cancellable</code></em> is not <code class="literal">NULL</code>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation 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 operation was partially finished when the operation was cancelled the partial result will be returned, without an error.</p> <p>On error -1 is returned and <em class="parameter"><code>error</code></em> is set accordingly.</p> <p>Virtual: write_fn</p> <div class="refsect3"> <a name="g-output-stream-write.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer</p></td> <td class="parameter_description"><p>the buffer containing the data to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=count][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>count</p></td> <td class="parameter_description"><p>the number of bytes to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional cancellable object. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-write.returns"></a><h4>Returns</h4> <p> Number of bytes written, or -1 on error</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-all"></a><h3>g_output_stream_write_all ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_write_all (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <span class="type">void</span> *buffer</code></em>, <em class="parameter"><code><span class="type">gsize</span> count</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Tries to write <em class="parameter"><code>count</code></em> bytes from <em class="parameter"><code>buffer</code></em> into the stream. Will block during the operation.</p> <p>This function is similar to <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a>, except it tries to write as many bytes as requested, only stopping on an error.</p> <p>On a successful write of <em class="parameter"><code>count</code></em> bytes, <code class="literal">TRUE</code> is returned, and <em class="parameter"><code>bytes_written</code></em> is set to <em class="parameter"><code>count</code></em> .</p> <p>If there is an error during the operation <code class="literal">FALSE</code> is returned and <em class="parameter"><code>error</code></em> is set to indicate the error status.</p> <p>As a special exception to the normal conventions for functions that use <span class="type">GError</span>, if this function returns <code class="literal">FALSE</code> (and sets <em class="parameter"><code>error</code></em> ) then <em class="parameter"><code>bytes_written</code></em> will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-write-all.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer</p></td> <td class="parameter_description"><p>the buffer containing the data to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=count][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>count</p></td> <td class="parameter_description"><p>the number of bytes to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that was written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-write-all.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-all-async"></a><h3>g_output_stream_write_all_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_write_all_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <span class="type">void</span> *buffer</code></em>, <em class="parameter"><code><span class="type">gsize</span> count</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Request an asynchronous write of <em class="parameter"><code>count</code></em> bytes from <em class="parameter"><code>buffer</code></em> into the stream. When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-write-all-finish" title="g_output_stream_write_all_finish ()"><code class="function">g_output_stream_write_all_finish()</code></a> to get the result of the operation.</p> <p>This is the asynchronous version of <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a>.</p> <p>Call <a class="link" href="GOutputStream.html#g-output-stream-write-all-finish" title="g_output_stream_write_all_finish ()"><code class="function">g_output_stream_write_all_finish()</code></a> to collect the result.</p> <p>Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is <code class="literal">G_PRIORITY_DEFAULT</code>.</p> <p>Note that no copy of <em class="parameter"><code>buffer</code></em> will be made, so it must stay valid until <em class="parameter"><code>callback</code></em> is called.</p> <div class="refsect3"> <a name="g-output-stream-write-all-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer</p></td> <td class="parameter_description"><p>the buffer containing the data to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=count][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>count</p></td> <td class="parameter_description"><p>the number of bytes to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the io priority of the request</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>callback to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-all-finish"></a><h3>g_output_stream_write_all_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_write_all_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes an asynchronous stream write operation started with <a class="link" href="GOutputStream.html#g-output-stream-write-all-async" title="g_output_stream_write_all_async ()"><code class="function">g_output_stream_write_all_async()</code></a>.</p> <p>As a special exception to the normal conventions for functions that use <span class="type">GError</span>, if this function returns <code class="literal">FALSE</code> (and sets <em class="parameter"><code>error</code></em> ) then <em class="parameter"><code>bytes_written</code></em> will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around <a class="link" href="GOutputStream.html#g-output-stream-write-async" title="g_output_stream_write_async ()"><code class="function">g_output_stream_write_async()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-write-all-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that was written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-write-all-finish.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-44.html#api-index-2.44">2.44</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-writev"></a><h3>g_output_stream_writev ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_writev (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> *vectors</code></em>, <em class="parameter"><code><span class="type">gsize</span> n_vectors</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Tries to write the bytes contained in the <em class="parameter"><code>n_vectors</code></em> <em class="parameter"><code>vectors</code></em> into the stream. Will block during the operation.</p> <p>If <em class="parameter"><code>n_vectors</code></em> is 0 or the sum of all bytes in <em class="parameter"><code>vectors</code></em> is 0, returns 0 and does nothing.</p> <p>On success, the number of bytes written to the stream is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, or if there is not enough storage in the stream. All writes block until at least one byte is written or an error occurs; 0 is never returned (unless <em class="parameter"><code>n_vectors</code></em> is 0 or the sum of all bytes in <em class="parameter"><code>vectors</code></em> is 0).</p> <p>If <em class="parameter"><code>cancellable</code></em> is not <code class="literal">NULL</code>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation 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 operation was partially finished when the operation was cancelled the partial result will be returned, without an error.</p> <p>Some implementations of <a class="link" href="GOutputStream.html#g-output-stream-writev" title="g_output_stream_writev ()"><code class="function">g_output_stream_writev()</code></a> may have limitations on the aggregate buffer size, and will return <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a> if these are exceeded. For example, when writing to a local file on UNIX platforms, the aggregate buffer size must not exceed <code class="literal">G_MAXSSIZE</code> bytes.</p> <p>Virtual: writev_fn</p> <div class="refsect3"> <a name="g-output-stream-writev.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>vectors</p></td> <td class="parameter_description"><p>the buffer containing the <a href="GSocket.html#GOutputVector"><span class="type">GOutputVectors</span></a> to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_vectors]</span></td> </tr> <tr> <td class="parameter_name"><p>n_vectors</p></td> <td class="parameter_description"><p>the number of vectors to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that were written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional cancellable object. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-writev.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-writev-all"></a><h3>g_output_stream_writev_all ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_writev_all (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> *vectors</code></em>, <em class="parameter"><code><span class="type">gsize</span> n_vectors</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Tries to write the bytes contained in the <em class="parameter"><code>n_vectors</code></em> <em class="parameter"><code>vectors</code></em> into the stream. Will block during the operation.</p> <p>This function is similar to <a class="link" href="GOutputStream.html#g-output-stream-writev" title="g_output_stream_writev ()"><code class="function">g_output_stream_writev()</code></a>, except it tries to write as many bytes as requested, only stopping on an error.</p> <p>On a successful write of all <em class="parameter"><code>n_vectors</code></em> vectors, <code class="literal">TRUE</code> is returned, and <em class="parameter"><code>bytes_written</code></em> is set to the sum of all the sizes of <em class="parameter"><code>vectors</code></em> .</p> <p>If there is an error during the operation <code class="literal">FALSE</code> is returned and <em class="parameter"><code>error</code></em> is set to indicate the error status.</p> <p>As a special exception to the normal conventions for functions that use <span class="type">GError</span>, if this function returns <code class="literal">FALSE</code> (and sets <em class="parameter"><code>error</code></em> ) then <em class="parameter"><code>bytes_written</code></em> will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a>.</p> <p>The content of the individual elements of <em class="parameter"><code>vectors</code></em> might be changed by this function.</p> <div class="refsect3"> <a name="g-output-stream-writev-all.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>vectors</p></td> <td class="parameter_description"><p>the buffer containing the <a href="GSocket.html#GOutputVector"><span class="type">GOutputVectors</span></a> to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_vectors]</span></td> </tr> <tr> <td class="parameter_name"><p>n_vectors</p></td> <td class="parameter_description"><p>the number of vectors to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that were written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-writev-all.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-writev-async"></a><h3>g_output_stream_writev_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_writev_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> *vectors</code></em>, <em class="parameter"><code><span class="type">gsize</span> n_vectors</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Request an asynchronous write of the bytes contained in <em class="parameter"><code>n_vectors</code></em> <em class="parameter"><code>vectors</code></em> into the stream. When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-writev-finish" title="g_output_stream_writev_finish ()"><code class="function">g_output_stream_writev_finish()</code></a> to get the result of the operation.</p> <p>During an async request no other sync and async calls are allowed, and will result in <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING:CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> errors.</p> <p>On success, the number of bytes written will be passed to the <em class="parameter"><code>callback</code></em> . It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, but generally we try to write as many bytes as requested.</p> <p>You are guaranteed that this method will never fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> — if <em class="parameter"><code>stream</code></em> can't accept more data, the method will just wait until this changes.</p> <p>Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is <code class="literal">G_PRIORITY_DEFAULT</code>.</p> <p>The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.</p> <p>For the synchronous, blocking version of this function, see <a class="link" href="GOutputStream.html#g-output-stream-writev" title="g_output_stream_writev ()"><code class="function">g_output_stream_writev()</code></a>.</p> <p>Note that no copy of <em class="parameter"><code>vectors</code></em> will be made, so it must stay valid until <em class="parameter"><code>callback</code></em> is called.</p> <div class="refsect3"> <a name="g-output-stream-writev-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>vectors</p></td> <td class="parameter_description"><p>the buffer containing the <a href="GSocket.html#GOutputVector"><span class="type">GOutputVectors</span></a> to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_vectors]</span></td> </tr> <tr> <td class="parameter_name"><p>n_vectors</p></td> <td class="parameter_description"><p>the number of vectors to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the I/O priority of the request.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>callback to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-writev-finish"></a><h3>g_output_stream_writev_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_writev_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes a stream writev operation.</p> <div class="refsect3"> <a name="g-output-stream-writev-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that were written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-writev-finish.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-writev-all-async"></a><h3>g_output_stream_writev_all_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_writev_all_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> *vectors</code></em>, <em class="parameter"><code><span class="type">gsize</span> n_vectors</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Request an asynchronous write of the bytes contained in the <em class="parameter"><code>n_vectors</code></em> <em class="parameter"><code>vectors</code></em> into the stream. When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-writev-all-finish" title="g_output_stream_writev_all_finish ()"><code class="function">g_output_stream_writev_all_finish()</code></a> to get the result of the operation.</p> <p>This is the asynchronous version of <a class="link" href="GOutputStream.html#g-output-stream-writev-all" title="g_output_stream_writev_all ()"><code class="function">g_output_stream_writev_all()</code></a>.</p> <p>Call <a class="link" href="GOutputStream.html#g-output-stream-writev-all-finish" title="g_output_stream_writev_all_finish ()"><code class="function">g_output_stream_writev_all_finish()</code></a> to collect the result.</p> <p>Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is <code class="literal">G_PRIORITY_DEFAULT</code>.</p> <p>Note that no copy of <em class="parameter"><code>vectors</code></em> will be made, so it must stay valid until <em class="parameter"><code>callback</code></em> is called. The content of the individual elements of <em class="parameter"><code>vectors</code></em> might be changed by this function.</p> <div class="refsect3"> <a name="g-output-stream-writev-all-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>vectors</p></td> <td class="parameter_description"><p>the buffer containing the <a href="GSocket.html#GOutputVector"><span class="type">GOutputVectors</span></a> to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_vectors]</span></td> </tr> <tr> <td class="parameter_name"><p>n_vectors</p></td> <td class="parameter_description"><p>the number of vectors to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the I/O priority of the request</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>callback to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-writev-all-finish"></a><h3>g_output_stream_writev_all_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_writev_all_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes an asynchronous stream write operation started with <a class="link" href="GOutputStream.html#g-output-stream-writev-all-async" title="g_output_stream_writev_all_async ()"><code class="function">g_output_stream_writev_all_async()</code></a>.</p> <p>As a special exception to the normal conventions for functions that use <span class="type">GError</span>, if this function returns <code class="literal">FALSE</code> (and sets <em class="parameter"><code>error</code></em> ) then <em class="parameter"><code>bytes_written</code></em> will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around <a class="link" href="GOutputStream.html#g-output-stream-writev-async" title="g_output_stream_writev_async ()"><code class="function">g_output_stream_writev_async()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-writev-all-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that were written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-writev-all-finish.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-splice"></a><h3>g_output_stream_splice ()</h3> <pre class="programlisting"><span class="returnvalue">gssize</span> g_output_stream_splice (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> *source</code></em>, <em class="parameter"><code><a class="link" href="GOutputStream.html#GOutputStreamSpliceFlags" title="enum GOutputStreamSpliceFlags"><span class="type">GOutputStreamSpliceFlags</span></a> flags</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Splices an input stream into an output stream.</p> <div class="refsect3"> <a name="g-output-stream-splice.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>source</p></td> <td class="parameter_description"><p>a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>flags</p></td> <td class="parameter_description"><p>a set of <a class="link" href="GOutputStream.html#GOutputStreamSpliceFlags" title="enum GOutputStreamSpliceFlags"><span class="type">GOutputStreamSpliceFlags</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-splice.returns"></a><h4>Returns</h4> <p> a <span class="type">gssize</span> containing the size of the data spliced, or -1 if an error occurred. Note that if the number of bytes spliced is greater than <code class="literal">G_MAXSSIZE</code>, then that will be returned, and there is no way to determine the actual number of bytes spliced.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-flush"></a><h3>g_output_stream_flush ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_flush (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Forces a write of all user-space buffered data for the given <em class="parameter"><code>stream</code></em> . Will block during the operation. Closing the stream will implicitly cause a flush.</p> <p>This function is optional for inherited classes.</p> <p>If <em class="parameter"><code>cancellable</code></em> is not <code class="literal">NULL</code>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation 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> <div class="refsect3"> <a name="g-output-stream-flush.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional cancellable object. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-flush.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> on error</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-close"></a><h3>g_output_stream_close ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_close (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Closes the stream, releasing resources related to it.</p> <p>Once the stream is closed, all other operations will return <a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. Closing a stream multiple times will not return an error.</p> <p>Closing a stream will automatically flush any outstanding buffers in the stream.</p> <p>Streams will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.</p> <p>Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details.</p> <p>On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to 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 is important to check and report the error to the user, otherwise there might be a loss of data as all data might not be written.</p> <p>If <em class="parameter"><code>cancellable</code></em> is not <code class="literal">NULL</code>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation 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. Cancelling a close will still leave the stream closed, but there some streams can use a faster close that doesn't block to e.g. check errors. On cancellation (as with any error) there is no guarantee that all written data will reach the target.</p> <div class="refsect3"> <a name="g-output-stream-close.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional cancellable object. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-close.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> on failure</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-async"></a><h3>g_output_stream_write_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_write_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <span class="type">void</span> *buffer</code></em>, <em class="parameter"><code><span class="type">gsize</span> count</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Request an asynchronous write of <em class="parameter"><code>count</code></em> bytes from <em class="parameter"><code>buffer</code></em> into the stream. When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-write-finish" title="g_output_stream_write_finish ()"><code class="function">g_output_stream_write_finish()</code></a> to get the result of the operation.</p> <p>During an async request no other sync and async calls are allowed, and will result in <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING:CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> errors. </p> <p>A value of <em class="parameter"><code>count</code></em> larger than <code class="literal">G_MAXSSIZE</code> 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.</p> <p>On success, the number of bytes written will be passed to the <em class="parameter"><code>callback</code></em> . It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, but generally we try to write as many bytes as requested. </p> <p>You are guaranteed that this method will never fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> - if <em class="parameter"><code>stream</code></em> can't accept more data, the method will just wait until this changes.</p> <p>Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is <code class="literal">G_PRIORITY_DEFAULT</code>.</p> <p>The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.</p> <p>For the synchronous, blocking version of this function, see <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a>.</p> <p>Note that no copy of <em class="parameter"><code>buffer</code></em> will be made, so it must stay valid until <em class="parameter"><code>callback</code></em> is called. See <a class="link" href="GOutputStream.html#g-output-stream-write-bytes-async" title="g_output_stream_write_bytes_async ()"><code class="function">g_output_stream_write_bytes_async()</code></a> for a <span class="type">GBytes</span> version that will automatically hold a reference to the contents (without copying) for the duration of the call.</p> <div class="refsect3"> <a name="g-output-stream-write-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer</p></td> <td class="parameter_description"><p>the buffer containing the data to write. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=count][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>count</p></td> <td class="parameter_description"><p>the number of bytes to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the io priority of the request.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>callback to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-finish"></a><h3>g_output_stream_write_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gssize</span> g_output_stream_write_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes a stream write operation.</p> <div class="refsect3"> <a name="g-output-stream-write-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-write-finish.returns"></a><h4>Returns</h4> <p> a <span class="type">gssize</span> containing the number of bytes written to the stream.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-splice-async"></a><h3>g_output_stream_splice_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_splice_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> *source</code></em>, <em class="parameter"><code><a class="link" href="GOutputStream.html#GOutputStreamSpliceFlags" title="enum GOutputStreamSpliceFlags"><span class="type">GOutputStreamSpliceFlags</span></a> flags</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Splices a stream asynchronously. When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-splice-finish" title="g_output_stream_splice_finish ()"><code class="function">g_output_stream_splice_finish()</code></a> to get the result of the operation.</p> <p>For the synchronous, blocking version of this function, see <a class="link" href="GOutputStream.html#g-output-stream-splice" title="g_output_stream_splice ()"><code class="function">g_output_stream_splice()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-splice-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>source</p></td> <td class="parameter_description"><p>a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>. </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>flags</p></td> <td class="parameter_description"><p>a set of <a class="link" href="GOutputStream.html#GOutputStreamSpliceFlags" title="enum GOutputStreamSpliceFlags"><span class="type">GOutputStreamSpliceFlags</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the io priority of the request.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>user data passed to <em class="parameter"><code>callback</code></em> . </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-splice-finish"></a><h3>g_output_stream_splice_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gssize</span> g_output_stream_splice_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes an asynchronous stream splice operation.</p> <div class="refsect3"> <a name="g-output-stream-splice-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-splice-finish.returns"></a><h4>Returns</h4> <p> a <span class="type">gssize</span> of the number of bytes spliced. Note that if the number of bytes spliced is greater than <code class="literal">G_MAXSSIZE</code>, then that will be returned, and there is no way to determine the actual number of bytes spliced.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-flush-async"></a><h3>g_output_stream_flush_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_flush_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Forces an asynchronous write of all user-space buffered data for the given <em class="parameter"><code>stream</code></em> . For behaviour details see <a class="link" href="GOutputStream.html#g-output-stream-flush" title="g_output_stream_flush ()"><code class="function">g_output_stream_flush()</code></a>.</p> <p>When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-flush-finish" title="g_output_stream_flush_finish ()"><code class="function">g_output_stream_flush_finish()</code></a> to get the result of the operation.</p> <div class="refsect3"> <a name="g-output-stream-flush-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the io priority of the request.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-flush-finish"></a><h3>g_output_stream_flush_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_flush_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes flushing an output stream.</p> <div class="refsect3"> <a name="g-output-stream-flush-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a GAsyncResult.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-flush-finish.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if flush operation succeeded, <code class="literal">FALSE</code> otherwise.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-close-async"></a><h3>g_output_stream_close_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_close_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished <em class="parameter"><code>callback</code></em> will be called. You can then call <a class="link" href="GOutputStream.html#g-output-stream-close-finish" title="g_output_stream_close_finish ()"><code class="function">g_output_stream_close_finish()</code></a> to get the result of the operation.</p> <p>For behaviour details see <a class="link" href="GOutputStream.html#g-output-stream-close" title="g_output_stream_close ()"><code class="function">g_output_stream_close()</code></a>.</p> <p>The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.</p> <div class="refsect3"> <a name="g-output-stream-close-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the io priority of the request.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional cancellable object. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>callback to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-close-finish"></a><h3>g_output_stream_close_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_close_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Closes an output stream.</p> <div class="refsect3"> <a name="g-output-stream-close-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-close-finish.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if stream was successfully closed, <code class="literal">FALSE</code> otherwise.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-is-closing"></a><h3>g_output_stream_is_closing ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_is_closing (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>);</pre> <p>Checks if an output stream is being closed. This can be used inside e.g. a flush implementation to see if the flush (or other i/o operation) is called from within the closing operation.</p> <div class="refsect3"> <a name="g-output-stream-is-closing.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-is-closing.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if <em class="parameter"><code>stream</code></em> is being closed. <code class="literal">FALSE</code> otherwise.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-is-closed"></a><h3>g_output_stream_is_closed ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_is_closed (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>);</pre> <p>Checks if an output stream has already been closed.</p> <div class="refsect3"> <a name="g-output-stream-is-closed.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-is-closed.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if <em class="parameter"><code>stream</code></em> is closed. <code class="literal">FALSE</code> otherwise. </p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-has-pending"></a><h3>g_output_stream_has_pending ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_has_pending (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>);</pre> <p>Checks if an output stream has pending actions.</p> <div class="refsect3"> <a name="g-output-stream-has-pending.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-has-pending.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if <em class="parameter"><code>stream</code></em> has pending actions. </p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-set-pending"></a><h3>g_output_stream_set_pending ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_set_pending (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Sets <em class="parameter"><code>stream</code></em> to have actions pending. If the pending flag is already set or <em class="parameter"><code>stream</code></em> is closed, it will return <code class="literal">FALSE</code> and set <em class="parameter"><code>error</code></em> .</p> <div class="refsect3"> <a name="g-output-stream-set-pending.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-set-pending.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if pending was previously unset and is now set.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-clear-pending"></a><h3>g_output_stream_clear_pending ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_clear_pending (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>);</pre> <p>Clears the pending flag on <em class="parameter"><code>stream</code></em> .</p> <div class="refsect3"> <a name="g-output-stream-clear-pending.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>output stream</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-bytes"></a><h3>g_output_stream_write_bytes ()</h3> <pre class="programlisting"><span class="returnvalue">gssize</span> g_output_stream_write_bytes (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">GBytes</span> *bytes</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>A wrapper function for <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a> which takes a <span class="type">GBytes</span> as input. This can be more convenient for use by language bindings or in other cases where the refcounted nature of <span class="type">GBytes</span> is helpful over a bare pointer interface.</p> <p>However, note that this function may still perform partial writes, just like <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a>. If that occurs, to continue writing, you will need to create a new <span class="type">GBytes</span> containing just the remaining bytes, using <code class="function">g_bytes_new_from_bytes()</code>. Passing the same <span class="type">GBytes</span> instance multiple times potentially can result in duplicated data in the output stream.</p> <div class="refsect3"> <a name="g-output-stream-write-bytes.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes</p></td> <td class="parameter_description"><p>the <span class="type">GBytes</span> to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional cancellable object. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-write-bytes.returns"></a><h4>Returns</h4> <p> Number of bytes written, or -1 on error</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-bytes-async"></a><h3>g_output_stream_write_bytes_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_output_stream_write_bytes_async (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">GBytes</span> *bytes</code></em>, <em class="parameter"><code><span class="type">int</span> io_priority</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre> <p>This function is similar to <a class="link" href="GOutputStream.html#g-output-stream-write-async" title="g_output_stream_write_async ()"><code class="function">g_output_stream_write_async()</code></a>, but takes a <span class="type">GBytes</span> as input. Due to the refcounted nature of <span class="type">GBytes</span>, this allows the stream to avoid taking a copy of the data.</p> <p>However, note that this function may still perform partial writes, just like <a class="link" href="GOutputStream.html#g-output-stream-write-async" title="g_output_stream_write_async ()"><code class="function">g_output_stream_write_async()</code></a>. If that occurs, to continue writing, you will need to create a new <span class="type">GBytes</span> containing just the remaining bytes, using <code class="function">g_bytes_new_from_bytes()</code>. Passing the same <span class="type">GBytes</span> instance multiple times potentially can result in duplicated data in the output stream.</p> <p>For the synchronous, blocking version of this function, see <a class="link" href="GOutputStream.html#g-output-stream-write-bytes" title="g_output_stream_write_bytes ()"><code class="function">g_output_stream_write_bytes()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-write-bytes-async.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>A <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes</p></td> <td class="parameter_description"><p>The bytes to write</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>io_priority</p></td> <td class="parameter_description"><p>the io priority of the request.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>callback to call when the request is satisfied. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to callback function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-write-bytes-finish"></a><h3>g_output_stream_write_bytes_finish ()</h3> <pre class="programlisting"><span class="returnvalue">gssize</span> g_output_stream_write_bytes_finish (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre> <p>Finishes a stream write-from-<span class="type">GBytes</span> operation.</p> <div class="refsect3"> <a name="g-output-stream-write-bytes-finish.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <span class="type">GError</span> location to store the error occurring, or <code class="literal">NULL</code> to ignore.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-write-bytes-finish.returns"></a><h4>Returns</h4> <p> a <span class="type">gssize</span> containing the number of bytes written to the stream.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-output-stream-printf"></a><h3>g_output_stream_printf ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_printf (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> *format</code></em>, <em class="parameter"><code>...</code></em>);</pre> <p>This is a utility function around <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a>. It uses <code class="function">g_strdup_vprintf()</code> to turn <em class="parameter"><code>format</code></em> and @... into a string that is then written to <em class="parameter"><code>stream</code></em> .</p> <p>See the documentation of <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a> about the behavior of the actual write operation.</p> <p>Note that partial writes cannot be properly checked with this function due to the variable length of the written string, if you need precise control over partial write failures, you need to create you own <code class="function">printf()</code>-like wrapper around <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a> or <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-printf.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that was written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>format</p></td> <td class="parameter_description"><p>the format string. See the <code class="function">printf()</code> documentation</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>the parameters to insert into the format string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-printf.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p> </div> <hr> <div class="refsect2"> <a name="g-output-stream-vprintf"></a><h3>g_output_stream_vprintf ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_output_stream_vprintf (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code><span class="type">gsize</span> *bytes_written</code></em>, <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><span class="type">GError</span> **error</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> *format</code></em>, <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre> <p>This is a utility function around <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a>. It uses <code class="function">g_strdup_vprintf()</code> to turn <em class="parameter"><code>format</code></em> and <em class="parameter"><code>args</code></em> into a string that is then written to <em class="parameter"><code>stream</code></em> .</p> <p>See the documentation of <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a> about the behavior of the actual write operation.</p> <p>Note that partial writes cannot be properly checked with this function due to the variable length of the written string, if you need precise control over partial write failures, you need to create you own <code class="function">printf()</code>-like wrapper around <a class="link" href="GOutputStream.html#g-output-stream-write" title="g_output_stream_write ()"><code class="function">g_output_stream_write()</code></a> or <a class="link" href="GOutputStream.html#g-output-stream-write-all" title="g_output_stream_write_all ()"><code class="function">g_output_stream_write_all()</code></a>.</p> <div class="refsect3"> <a name="g-output-stream-vprintf.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>bytes_written</p></td> <td class="parameter_description"><p>location to store the number of bytes that was written to the stream. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <code class="literal">NULL</code> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <code class="literal">NULL</code> to ignore</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>format</p></td> <td class="parameter_description"><p>the format string. See the <code class="function">printf()</code> documentation</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>args</p></td> <td class="parameter_description"><p>the parameters to insert into the format string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-output-stream-vprintf.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if there was an error</p> </div> <p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p> </div> </div> <div class="refsect1"> <a name="GOutputStream.other_details"></a><h2>Types and Values</h2> <div class="refsect2"> <a name="GOutputStreamSpliceFlags"></a><h3>enum GOutputStreamSpliceFlags</h3> <p>GOutputStreamSpliceFlags determine how streams should be spliced.</p> <div class="refsect3"> <a name="GOutputStreamSpliceFlags.members"></a><h4>Members</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="300px" class="enum_members_name"> <col class="enum_members_description"> <col width="200px" class="enum_members_annotations"> </colgroup> <tbody> <tr> <td class="enum_member_name"><p><a name="G-OUTPUT-STREAM-SPLICE-NONE:CAPS"></a>G_OUTPUT_STREAM_SPLICE_NONE</p></td> <td class="enum_member_description"> <p>Do not close either stream.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-OUTPUT-STREAM-SPLICE-CLOSE-SOURCE:CAPS"></a>G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE</p></td> <td class="enum_member_description"> <p>Close the source stream after the splice.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-OUTPUT-STREAM-SPLICE-CLOSE-TARGET:CAPS"></a>G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET</p></td> <td class="enum_member_description"> <p>Close the target stream after the splice.</p> </td> <td class="enum_member_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="GOutputStream-struct"></a><h3>GOutputStream</h3> <pre class="programlisting">typedef struct _GOutputStream GOutputStream;</pre> <p>Base class for writing output.</p> <p>All classes derived from GOutputStream should implement synchronous writing, splicing, flushing and closing streams, but may implement asynchronous versions.</p> </div> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>