summaryrefslogtreecommitdiff
path: root/docs/reference/pygio-fileinputstream.xml
blob: 723dc6454d08979e9f76e1314d83be4aba34c30f (plain)
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
<?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-giofileinputstream">
    <refnamediv>
        <refname>gio.FileInputStream</refname>
        <refpurpose>Base class for implementing streaming input</refpurpose>
    </refnamediv>

    <refsect1>
        <title>Synopsis</title>

    <classsynopsis language="python">
        <ooclass><classname>gio.FileInputStream</classname></ooclass>
        <ooclass><classname><link linkend="class-gioinputstream">gio.InputStream</link></classname></ooclass>

    <methodsynopsis language="python">
        <methodname><link linkend="method-giofileinputstream--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-giofileinputstream--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-giofileinputstream--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-gioinputstream">gio.InputStream</link>
    +-- <link linkend="class-giofileinputstream">gio.FileInputStream</link>
</synopsis>

    </refsect1>
    
    <refsect1>
	<title>Implemented Interfaces</title>
        <para>
            <link linkend="class-giofileinputstream"><classname>gio.FileInputStream</classname></link>
            implements
            <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link>
        </para>
    </refsect1>

    <refsect1>
        <title>Description</title>

        <para>
            <link linkend="class-giofileinputstream"><classname>gio.FileInputStream</classname></link>
            provides input streams that take their content from a file.
        </para>
        <para>
            <link linkend="class-giofileinputstream"><classname>gio.FileInputStream</classname></link>
            implements <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link>,
            which allows the input stream to jump to arbitrary positions in the file, provided the filesystem
            of the file allows it. In addition to the generic g_seekable_ API,
            <link linkend="class-giofileinputstream"><classname>gio.FileInputStream</classname></link>
            has its own API for seeking and positioning. To find the position of a file input stream, use
            <methodname><link linkend="method-gioseekable--tell">gio.Seekable.tell</link></methodname>().
            To find out if a file input stream supports seeking, use
            <methodname><link linkend="method-gioseekable--can_seek">gio.Seekable.can_seek</link></methodname>().
            To position a file input stream, use
            <methodname><link linkend="method-gioseekable--seek">gio.Seekable.seek</link></methodname>().
        </para>
    </refsect1>

    <refsect1>
        <title>Methods</title>

        <refsect2 id="method-giofileinputstream--query-info">
            <title>gio.FileInputStream.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>&nbsp;:</term>
                  <listitem><simpara>a file attribute query string.
                  </simpara></listitem>
                </varlistentry>
                <varlistentry>
                  <term><parameter role="keyword">cancellable</parameter>&nbsp;:</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>&nbsp;:</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-giofileinputstream--query-info-async">gio.FileInputStream.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>
        </refsect2>

        <refsect2 id="method-giofileinputstream--query-info-async">
            <title>gio.FileInputStream.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>&nbsp;:</term>
                  <listitem><simpara>a file attribute query string.
                  </simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><parameter>callback</parameter>&nbsp;:</term>
                    <listitem><simpara>a GAsyncReadyCallback to call when the request is satisfied.
                    </simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><parameter>io_priority</parameter>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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-giofileinputstream--query-info-finish">gio.FileInputStream.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-giofileinputstream--query-info">gio.FileInputStream.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-giofileinputstream--query-info-finish">
            <title>gio.FileInputStream.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>&nbsp;:</term>
                  <listitem><simpara>a <link linkend="class-gioasyncresult"><classname>gio.AsyncResult</classname></link>.
                  </simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</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-giofileinputstream--query-info-async">gio.FileInputStream.query_info_async</link></methodname>().
            </para>
        </refsect2>
    </refsect1>
</refentry>