diff options
author | Gian Mario Tagliaretti <gianmt@gnome.org> | 2009-06-15 23:02:34 +0200 |
---|---|---|
committer | Gian Mario Tagliaretti <gianmt@gnome.org> | 2009-06-15 23:03:50 +0200 |
commit | 5c36ef20dca8cd1793f2d3e88949675299097f40 (patch) | |
tree | 8311205c63ede9705ddc195982f7a8a31f04ec68 /docs | |
parent | a8b36c343c6850af929c1d5a930f923831b4e637 (diff) | |
download | pygobject-5c36ef20dca8cd1793f2d3e88949675299097f40.tar.gz pygobject-5c36ef20dca8cd1793f2d3e88949675299097f40.tar.xz pygobject-5c36ef20dca8cd1793f2d3e88949675299097f40.zip |
Add dpcs for class gio.DataInputStream
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Makefile.am | 2 | ||||
-rw-r--r-- | docs/reference/pygio-classes.xml | 1 | ||||
-rw-r--r-- | docs/reference/pygio-constants.xml | 66 | ||||
-rw-r--r-- | docs/reference/pygio-datainputstream.xml | 799 |
4 files changed, 868 insertions, 0 deletions
diff --git a/docs/Makefile.am b/docs/Makefile.am index 13d2703..02bd5d1 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -22,6 +22,7 @@ HTML_FILES = \ html/class-giobufferedinputstream.html \ html/class-giobufferedoutputstream.html \ html/class-giocancellable.html \ + html/class-giodatainputstream.html \ html/class-giodrive.html \ html/class-gioemblem.html \ html/class-gioemblemedicon.html \ @@ -81,6 +82,7 @@ XML_FILES = \ reference/pygio-bufferedinputstream.xml \ reference/pygio-bufferedoutputstream.xml \ reference/pygio-cancellable.xml \ + reference/pygio-datainputstream.xml \ reference/pygio-drive.xml \ reference/pygio-emblem.xml \ reference/pygio-emblemedicon.xml \ diff --git a/docs/reference/pygio-classes.xml b/docs/reference/pygio-classes.xml index 1c59d61..59e5168 100644 --- a/docs/reference/pygio-classes.xml +++ b/docs/reference/pygio-classes.xml @@ -13,6 +13,7 @@ <xi:include href="pygio-bufferedinputstream.xml"/> <xi:include href="pygio-bufferedoutputstream.xml"/> <xi:include href="pygio-cancellable.xml"/> +<xi:include href="pygio-datainputstream.xml"/> <xi:include href="pygio-drive.xml"/> <xi:include href="pygio-emblem.xml"/> <xi:include href="pygio-emblemedicon.xml"/> diff --git a/docs/reference/pygio-constants.xml b/docs/reference/pygio-constants.xml index f716e25..343927e 100644 --- a/docs/reference/pygio-constants.xml +++ b/docs/reference/pygio-constants.xml @@ -14,6 +14,8 @@ <programlisting> <xref linkend="gio-app-info-constants" endterm="gio-app-info-constants-title"></xref> <xref linkend="gio-ask-password-flags-constants" endterm="gio-ask-password-flags-constants-title"></xref> +<xref linkend="gio-data-stream-byte-order-constants" endterm="gio-data-stream-byte-order-constants-title"></xref> +<xref linkend="gio-data-stream-newline-type-constants" endterm="gio-data-stream-newline-type-constants-title"></xref> <xref linkend="gio-emblem-origin-constants" endterm="gio-emblem-origin-constants-title"></xref> <xref linkend="gio-error-constants" endterm="gio-error-constants-title"></xref> <xref linkend="gio-file-attribute-constants" endterm="gio-file-attribute-constants-title"></xref> @@ -106,6 +108,70 @@ </variablelist> </refsect2> + <refsect2 id="gio-data-stream-byte-order-constants"> + <title id="gio-data-stream-byte-order-constants-title">Gio Data Stream Byte Order Constants</title> + + <para> + Used to ensure proper endianness of streaming data sources across various machine architectures. + </para> + + <variablelist> + <varlistentry> + <term><literal>gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN</literal></term> + <listitem> + <simpara>Selects Big Endian byte order.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>gio.DATA_STREAM_BYTE_ORDER_HOST_ENDIAN</literal></term> + <listitem> + <simpara>Selects endianness based on host machine's architecture.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>gio.DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN</literal></term> + <listitem> + <simpara>Selects Little Endian byte order.</simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="gio-data-stream-newline-type-constants"> + <title id="gio-data-stream-newline-type-constants-title">Gio Data Stream Newline Type Constants</title> + + <para> + Used when checking for or setting the line endings for a given file. + </para> + + <variablelist> + <varlistentry> + <term><literal>gio.DATA_STREAM_NEWLINE_TYPE_LF</literal></term> + <listitem> + <simpara>Selects "LF" line endings, common on most modern UNIX platforms.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>gio.DATA_STREAM_NEWLINE_TYPE_CR</literal></term> + <listitem> + <simpara>Selects "CR" line endings.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>gio.DATA_STREAM_NEWLINE_TYPE_CR_LF</literal></term> + <listitem> + <simpara>Selects "CR, LF" line ending, common on Microsoft Windows.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>gio.DATA_STREAM_NEWLINE_TYPE_ANY</literal></term> + <listitem> + <simpara>Automatically try to handle any line ending type.</simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect2> + <refsect2 id="gio-emblem-origin-constants"> <title id="gio-emblem-origin-constants-title">Gio Emblem Origin Constants</title> diff --git a/docs/reference/pygio-datainputstream.xml b/docs/reference/pygio-datainputstream.xml new file mode 100644 index 0000000..403bb3e --- /dev/null +++ b/docs/reference/pygio-datainputstream.xml @@ -0,0 +1,799 @@ +<?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-giodatainputstream"> + <refnamediv> + <refname>gio.DataInputStream</refname> + <refpurpose>Data Input Stream</refpurpose> + </refnamediv> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>gio.DataInputStream</classname></ooclass> + <ooclass><classname><link linkend="class-giobufferedinputstream">gio.BufferedInputStream</link></classname></ooclass> + + <constructorsynopsis language="python"> + <methodname><link linkend="constructor-giodatainputstream">gio.DataInputStream</link></methodname> + <methodparam><parameter role="keyword">base_stream</parameter></methodparam> + </constructorsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--get-byte-order">get_byte_order</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--get-newline-type">get_newline_type</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-byte">read_byte</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-int16">read_int16</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-int32">read_int32</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-int64">read_int64</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-line">read_line</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-line-async">read_line_async</link></methodname> + <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-giodatainputstream--read-line-finish">read_line_finish</link></methodname> + <methodparam><parameter role="keyword">result</parameter></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-uint16">read_uint16</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-uint32">read_uint32</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-uint64">read_uint64</link></methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-until">read_until</link></methodname> + <methodparam><parameter role="keyword">stop_chars</parameter></methodparam> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--read-until-async">read_until_async</link></methodname> + <methodparam><parameter role="keyword">stop_chars</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-giodatainputstream--read-until-finish">read_until_finish</link></methodname> + <methodparam><parameter role="keyword">result</parameter></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--set-byte-order">set_byte_order</link></methodname> + <methodparam><parameter role="keyword">order</parameter></methodparam> + </methodsynopsis> + <methodsynopsis language="python"> + <methodname><link linkend="method-giodatainputstream--set-newline-type">set_newline_type</link></methodname> + <methodparam><parameter role="keyword">type</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-giofilterinputstream">gio.FilterInputStream</link> + +-- <link linkend="class-giobufferedinputstream">gio.BufferedInputStream</link> + +-- <link linkend="class-giodatainputstream">gio.DataInputStream</link> +</synopsis> + + </refsect1> + + <refsect1 id="properties-giodatainputstream"> + <title>gio.DataInputStream Properties</title> + + <blockquote role="properties"> + <informaltable pgwide="1" frame="none"> + <tgroup cols="3"> + <colspec column="1" colwidth="1in"/> + <colspec column="2" colwidth="1in"/> + <colspec column="3" colwidth="4in"/> + <tbody> + <row valign="top"> + <entry>"byte-order"</entry> + <entry>Read - Write</entry> + <entry>The byte order. Default value: gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN.</entry> + </row> + <row valign="top"> + <entry>"newline-type"</entry> + <entry>Read - Write</entry> + <entry>The accepted types of line ending. Default value: gio.DATA_STREAM_NEWLINE_TYPE_LF.</entry> + </row> + </tbody> + </tgroup> + </informaltable> + </blockquote> + + </refsect1> + + <refsect1> + <title>Description</title> + + <para> + <link linkend="class-giodatainputstream"><classname>gio.DataInputStream</classname></link> + implements <link linkend="class-gioinputstream"><classname>gio.InputStream</classname></link> + and includes functions for reading structured data directly from a binary input stream. + </para> + </refsect1> + + <refsect1 id="constructor-giodatainputstream"> + <title>Constructor</title> + + <programlisting><constructorsynopsis language="python"> + <methodname>gio.DataInputStream</methodname> + <methodparam><parameter role="keyword">base_stream</parameter></methodparam> + </constructorsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter>base_stream</parameter> :</term> + <listitem><simpara>a + <link linkend="class-gioinputstream"><classname>gio.InputStream</classname></link>. + </simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a new + <link linkend="class-giodatainputstream"><classname>gio.DataInputStream</classname></link> + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Creates a new <link linkend="class-giodatainputstream"><classname>gio.DataInputStream</classname></link> + from the given base_stream. + </para> + + </refsect1> + + <refsect1> + <title>Methods</title> + + <refsect2 id="method-giodatainputstream--get-byte-order"> + <title>gio.DataInputStream.get_byte_order</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_byte_order</methodname> + <methodparam></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the stream's current + <xref linkend="gio-data-stream-byte-order-constants" endterm="gio-data-stream-byte-order-constants-title"></xref>. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_byte_order</methodname>() method gets the byte + order for the data input stream. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--get-newline-type"> + <title>gio.DataInputStream.get_newline_type</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_newline_type</methodname> + <methodparam></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara><xref linkend="gio-data-stream-newline-type-constants" endterm="gio-data-stream-newline-type-constants-title"></xref> + for the given stream. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_newline_type</methodname>() method gets the current + newline type for the stream. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-byte"> + <title>gio.DataInputStream.read_byte</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_byte</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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>an unsigned 8-bit/1-byte value read from the + stream or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_byte</methodname>() method reads an unsigned 8-bit/1-byte value from stream. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-int16"> + <title>gio.DataInputStream.read_int16</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_int16</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 signed 16-bit/2-byte value read from stream or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_int16</methodname>() method reads a 16-bit/2-byte value from stream. + </para> + <para> + In order to get the correct byte order for this read operation, see + <methodname><link linkend="method-giodatainputstream--get-byte_order">gio.DataInputStream.get_byte_order</link></methodname>() + and + <methodname><link linkend="method-giodatainputstream--set-byte_order">gio.DataInputStream.set_byte_order</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 returned. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-int32"> + <title>gio.DataInputStream.read_int32</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_int32</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 signed 32-bit/4-byte value read from the stream + or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_int32</methodname>() method reads a signed 32-bit/4-byte value from stream. + </para> + <para> + In order to get the correct byte order for this read operation, see + <methodname><link linkend="method-giodatainputstream--get-byte_order">gio.DataInputStream.get_byte_order</link></methodname>() + and + <methodname><link linkend="method-giodatainputstream--set-byte_order">gio.DataInputStream.set_byte_order</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 returned. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-int64"> + <title>gio.DataInputStream.read_int64</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_int64</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 signed 64-bit/8-byte value read from the stream + or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_int64</methodname>() method reads a signed 64-bit/8-byte value from stream. + </para> + <para> + In order to get the correct byte order for this read operation, see + <methodname><link linkend="method-giodatainputstream--get-byte_order">gio.DataInputStream.get_byte_order</link></methodname>() + and + <methodname><link linkend="method-giodatainputstream--set-byte_order">gio.DataInputStream.set_byte_order</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 returned. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-line"> + <title>gio.DataInputStream.read_line</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_line</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 string with the line that was read in (without the newlines). + Set length to a gsize to get the length of the read line. On an error, it will return + <literal>None</literal> and error will be set. If there's no content to read, it + will still return <literal>None</literal>, but error won't be set. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_line</methodname>() reads a line from the data input stream. + </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 + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-line-async"> + <title>gio.DataInputStream.read_line_async</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_line_async</methodname> + <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>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>read_line_async</methodname>() method is the asynchronous version of + <methodname><link linkend="method-giodatainputstream--read-line">gio.DataInputStream.read_line</link></methodname>(). + It is an error to have two outstanding calls to this function. + </para> + <para> + For the synchronous version of this function, see + <methodname><link linkend="method-giodatainputstream--read-line">gio.DataInputStream.read_line</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-giodatainputstream--read-line-finish"> + <title>gio.DataInputStream.read_line_finish</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_line_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 string with the line that was read in (without the newlines). + On an error, it will return <literal>None</literal> and error will be set. + If there's no content to read, it will still return <literal>None</literal>, + but error won't be set. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_line_finish</methodname>() method finishes an asynchronous + file append operation started with + <methodname><link linkend="method-giodatainputstream--read-line-async">gio.DataInputStream.read_line_async</link></methodname>(). + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-uint16"> + <title>gio.DataInputStream.read_uint16</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_uint16</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 signed 16-bit/2-byte value read from stream or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_uint16</methodname>() method reads a 16-bit/2-byte value from stream. + </para> + <para> + In order to get the correct byte order for this read operation, see + <methodname><link linkend="method-giodatainputstream--get-byte_order">gio.DataInputStream.get_byte_order</link></methodname>() + and + <methodname><link linkend="method-giodatainputstream--set-byte_order">gio.DataInputStream.set_byte_order</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 returned. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-uint32"> + <title>gio.DataInputStream.read_uint32</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_uint32</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 signed 32-bit/4-byte value read from the stream + or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_uint32</methodname>() method reads a signed 32-bit/4-byte value from stream. + </para> + <para> + In order to get the correct byte order for this read operation, see + <methodname><link linkend="method-giodatainputstream--get-byte_order">gio.DataInputStream.get_byte_order</link></methodname>() + and + <methodname><link linkend="method-giodatainputstream--set-byte_order">gio.DataInputStream.set_byte_order</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 returned. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-uint64"> + <title>gio.DataInputStream.read_uint64</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_uint64</methodname> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <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 signed 64-bit/8-byte value read from the stream + or 0 if an error occurred. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_uint64</methodname>() method reads a signed 64-bit/8-byte value from stream. + </para> + <para> + In order to get the correct byte order for this read operation, see + <methodname><link linkend="method-giodatainputstream--get-byte_order">gio.DataInputStream.get_byte_order</link></methodname>() + and + <methodname><link linkend="method-giodatainputstream--set-byte_order">gio.DataInputStream.set_byte_order</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 returned. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-until"> + <title>gio.DataInputStream.read_until</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_until</methodname> + <methodparam><parameter role="keyword">stop_chars</parameter></methodparam> + <methodparam><parameter role="keyword">cancellable</parameter><initializer>None</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">stop_chars</parameter> :</term> + <listitem><simpara>characters to terminate the read. + </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 string with the data that was read before encountering + any of the stop characters. This function will return NULL on an error. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_until</methodname>() reads a string from the data input + stream, up to the first occurrence of any of the stop characters. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-until-async"> + <title>gio.DataInputStream.read_until_async</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_until_async</methodname> + <methodparam><parameter role="keyword">stop_chars</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">stop_chars</parameter> :</term> + <listitem><simpara>characters to terminate the read. + </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>read_until_async</methodname>() method it's the asynchronous version of + <methodname><link linkend="method-giodatainputstream--read-until">gio.DataInputStream.read_until</link></methodname>(). + It is an error to have two outstanding calls to this function. + </para> + <para> + For the synchronous version of this function, see + <methodname><link linkend="method-giodatainputstream--read-until">gio.DataInputStream.read_until</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> + <para> + When the operation is finished, callback will be called. You can then call + <methodname><link linkend="method-giodatainputstream--read-until-finish">gio.DataInputStream.read_until_finish</link></methodname>() + to get the result of the operation. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--read-until-finish"> + <title>gio.DataInputStream.read_until_finish</title> + + <programlisting><methodsynopsis language="python"> + <methodname>read_until_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 string with the data that was read before encountering + any of the stop characters. This function will return <literal>None</literal> on an error. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>read_until_finish</methodname>() method finishes an asynchronous + file append operation started with + <methodname><link linkend="method-giodatainputstream--read-until-async">gio.DataInputStream.read_until_async</link></methodname>(). + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--set-byte-order"> + <title>gio.DataInputStream.set_byte_order</title> + + <programlisting><methodsynopsis language="python"> + <methodname>set_byte_order</methodname> + <methodparam><parameter role="keyword">order</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">order</parameter> :</term> + <listitem><simpara>a + <xref linkend="gio-data-stream-byte-order-constants" endterm="gio-data-stream-byte-order-constants-title"></xref> to set. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>set_byte_order</methodname>() method sets the byte order for + the given stream. All subsequent reads from the stream will be read in the given order. + </para> + </refsect2> + + <refsect2 id="method-giodatainputstream--set-newline-type"> + <title>gio.DataInputStream.set_newline_type</title> + + <programlisting><methodsynopsis language="python"> + <methodname>set_newline_type</methodname> + <methodparam><parameter role="keyword">type</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">type</parameter> :</term> + <listitem><simpara>a + <xref linkend="gio-data-stream-newline-type-constants" endterm="gio-data-stream-newline-type-constants-title"></xref> to set. + </simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>set_newline_type</methodname>() method sets the newline type for the stream. + </para> + <note> + Note that using gio.DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a + read chunk ends in "CR" we must read an additional byte to know if this is + "CR" or "CR LF", and this might block if there is no more data availible. + </note> + </refsect2> + </refsect1> +</refentry> |