1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-giofileoutputstream">
<refnamediv>
<refname>gio.FileOutputStream</refname>
<refpurpose>Base class for implementing streaming input</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gio.FileOutputStream</classname></ooclass>
<ooclass><classname><link linkend="class-giooutputstream">gio.OutputStream</link></classname></ooclass>
<methodsynopsis language="python">
<methodname><link linkend="method-giofileoutputstream--get-etag">get_etag</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-giofileoutputstream--query-info">query_info</link></methodname>
<methodparam><parameter role="keyword">attributes</parameter></methodparam>
<methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-giofileoutputstream--query-info-async">query_info_async</link></methodname>
<methodparam><parameter role="keyword">attributes</parameter></methodparam>
<methodparam><parameter role="keyword">callback</parameter></methodparam>
<methodparam><parameter role="keyword">io_priority</parameter><initializer>glib.PRIORITY_DEFAULT</initializer></methodparam>
<methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam>
<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-giofileoutputstream--query-info-finish">query_info_finish</link></methodname>
<methodparam><parameter role="keyword">result</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+-- <link linkend="class-giooutputstream">gio.OutputStream</link>
+-- <link linkend="class-giofileoutputstream">gio.FileOutputStream</link>
</synopsis>
</refsect1>
<refsect1>
<title>Implemented Interfaces</title>
<para>
<link linkend="class-giofileoutputstream"><classname>gio.FileOutputStream</classname></link>
implements
<link linkend="class-gioseekable"><classname>gio.Seekable</classname></link>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
<link linkend="class-giofileoutputstream"><classname>gio.FileOutputStream</classname></link>
provides output streams that write their content to a file.
</para>
<para>
<link linkend="class-giofileoutputstream"><classname>gio.FileOutputStream</classname></link>
implements <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link>,
which allows the output stream to jump to arbitrary positions in the file and to truncate
the file, provided the filesystem of the file supports these operations. In addition to the
generic gio.Seekable. API,
<link linkend="class-giofileoutputstream"><classname>gio.FileOutputStream</classname></link>
has its own API for seeking and positioning. To find the position of a file output stream, use
<methodname><link linkend="method-gioseekable--tell">gio.Seekable.tell</link></methodname>().
To find out if a file output stream supports seeking, use
<methodname><link linkend="method-gioseekable--can_seek">gio.Seekable.can_seek</link></methodname>().
To position a file output stream, use
<methodname><link linkend="method-gioseekable--seek">gio.Seekable.seek</link></methodname>().
To find out if a file output stream supports truncating, use
<methodname><link linkend="method-gioseekable--can_truncate">gio.FileOutputStream.can_truncate</link></methodname>().
To truncate a file output stream, use
<methodname><link linkend="method-gioseekable--truncate">gio.Seekable.truncate</link></methodname>().
</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-giofileoutputstream--get-etag">
<title>gio.FileOutputStream.get_etag</title>
<programlisting><methodsynopsis language="python">
<methodname>get_etag</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the entity tag for the stream.
</simpara></listitem>
</varlistentry>
</variablelist>
<para>
The <methodname>get_etag</methodname>() method gets the entity tag
for the file when it has been written. This must be called after the
stream has been written and closed, as the etag can change while writing.
</para>
</refsect2>
<refsect2 id="method-giofileoutputstream--query-info">
<title>gio.FileOutputStream.query_info</title>
<programlisting><methodsynopsis language="python">
<methodname>query_info</methodname>
<methodparam><parameter role="keyword">attributes</parameter></methodparam>
<methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">attributes</parameter> :</term>
<listitem><simpara>a file attribute query string.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">cancellable</parameter> :</term>
<listitem><simpara>optional
<link linkend="class-giocancellable"><classname>gio.Cancellable</classname></link>
object, <literal>None</literal> to ignore.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link linkend="class-giofileinfo"><classname>gio.FileInfo</classname></link>,
or <literal>None</literal> on error.
</simpara></listitem>
</varlistentry>
</variablelist>
<para>
The <methodname>query_info</methodname>() method queries a file input stream
the given attributes. This function blocks while querying the stream.
For the asynchronous (non-blocking) version of this function, see
<methodname><link linkend="method-giofileoutputstream--query-info-async">gio.FileOutputStream.query_info_async</link></methodname>().
While the stream is blocked, the stream will set the pending flag internally,
and any other operations on the stream will fail with gio.ERROR_PENDING.
</para>
<para>
Can fail if the stream was already closed (with error being set to gio.ERROR_CLOSED),
the stream has pending operations (with error being set to gio.ERROR_PENDING), or
if querying info is not supported for the stream's interface (with error being set to
gio.ERROR_NOT_SUPPORTED). In all cases of failure, NULL will be returned.
</para>
<para>
If cancellable is not <literal>None</literal>, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation was cancelled,
the error gio.ERROR_CANCELLED will be set, and <literal>None</literal> will be returned.
</para>
</refsect2>
<refsect2 id="method-giofileoutputstream--query-info-async">
<title>gio.FileOutputStream.query_info_async</title>
<programlisting><methodsynopsis language="python">
<methodname>query_info_async</methodname>
<methodparam><parameter role="keyword">attributes</parameter></methodparam>
<methodparam><parameter role="keyword">callback</parameter></methodparam>
<methodparam><parameter role="keyword">io_priority</parameter><initializer>glib.PRIORITY_DEFAULT</initializer></methodparam>
<methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam>
<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">attributes</parameter> :</term>
<listitem><simpara>a file attribute query string.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>callback</parameter> :</term>
<listitem><simpara>a GAsyncReadyCallback to call when the request is satisfied.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>io_priority</parameter> :</term>
<listitem><simpara>the
<xref linkend="glib-priority-constants" endterm="glib-priority-constants-title"></xref>
of the request.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>cancellable</parameter> :</term>
<listitem><simpara>optional
<link linkend="class-giocancellable"><classname>gio.Cancellable</classname></link>
object, <literal>None</literal> to ignore.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>user_data</parameter> :</term>
<listitem><simpara>the data to pass to callback function.
</simpara></listitem>
</varlistentry>
</variablelist>
<para>
The <methodname>query_info_async</methodname>() method queries the stream
information asynchronously. When the operation is finished callback will be
called. You can then call
<methodname><link linkend="method-giofileoutputstream--query-info-finish">gio.FileOutputStream.query_info_finish</link></methodname>()
to get the result of the operation.
</para>
<para>
For the synchronous version of this function, see
<methodname><link linkend="method-giofileoutputstream--query-info">gio.FileOutputStream.query_info</link></methodname>().
</para>
<para>
If cancellable is not <literal>None</literal>, then the operation can be cancelled
by triggering the cancellable object from another thread. If the operation was
cancelled, the error gio.ERROR_CANCELLED will be set
</para>
</refsect2>
<refsect2 id="method-giofileoutputstream--query-info-finish">
<title>gio.FileOutputStream.query_info_finish</title>
<programlisting><methodsynopsis language="python">
<methodname>query_info_finish</methodname>
<methodparam><parameter role="keyword">result</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">result</parameter> :</term>
<listitem><simpara>a <link linkend="class-gioasyncresult"><classname>gio.AsyncResult</classname></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link linkend="class-giofileinfo"><classname>gio.FileInfo</classname></link>,
or <literal>None</literal> on error.
</simpara></listitem>
</varlistentry>
</variablelist>
<para>
The <methodname>query_info_finish</methodname>() method finishes an asynchronous
file append operation started with
<methodname><link linkend="method-giofileoutputstream--query-info-async">gio.FileOutputStream.query_info_async</link></methodname>().
</para>
</refsect2>
</refsect1>
</refentry>
|