<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="GDataInputStream">
<refmeta>
<refentrytitle role="top_of_page">GDataInputStream</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GIO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GDataInputStream</refname>
<refpurpose>Data Input Stream</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gio/gio.h&gt;


                    <link linkend="GDataInputStream-struct">GDataInputStream</link>;
enum                <link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link>;
enum                <link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link>;
<link linkend="GDataInputStream">GDataInputStream</link>*   <link linkend="g-data-input-stream-new">g_data_input_stream_new</link>             (<link linkend="GInputStream">GInputStream</link> *base_stream);
<link linkend="void">void</link>                <link linkend="g-data-input-stream-set-byte-order">g_data_input_stream_set_byte_order</link>  (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link> order);
<link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link> <link linkend="g-data-input-stream-get-byte-order">g_data_input_stream_get_byte_order</link> (<link linkend="GDataInputStream">GDataInputStream</link> *stream);
<link linkend="void">void</link>                <link linkend="g-data-input-stream-set-newline-type">g_data_input_stream_set_newline_type</link>
                                                        (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link> type);
<link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link> <link linkend="g-data-input-stream-get-newline-type">g_data_input_stream_get_newline_type</link>
                                                        (<link linkend="GDataInputStream">GDataInputStream</link> *stream);
<link linkend="guchar">guchar</link>              <link linkend="g-data-input-stream-read-byte">g_data_input_stream_read_byte</link>       (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gint16">gint16</link>              <link linkend="g-data-input-stream-read-int16">g_data_input_stream_read_int16</link>      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="guint16">guint16</link>             <link linkend="g-data-input-stream-read-uint16">g_data_input_stream_read_uint16</link>     (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gint32">gint32</link>              <link linkend="g-data-input-stream-read-int32">g_data_input_stream_read_int32</link>      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="guint32">guint32</link>             <link linkend="g-data-input-stream-read-uint32">g_data_input_stream_read_uint32</link>     (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gint64">gint64</link>              <link linkend="g-data-input-stream-read-int64">g_data_input_stream_read_int64</link>      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="guint64">guint64</link>             <link linkend="g-data-input-stream-read-uint64">g_data_input_stream_read_uint64</link>     (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="char">char</link>*               <link linkend="g-data-input-stream-read-line">g_data_input_stream_read_line</link>       (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="gsize">gsize</link> *length,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="char">char</link>*               <link linkend="g-data-input-stream-read-until">g_data_input_stream_read_until</link>      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         const <link linkend="gchar">gchar</link> *stop_chars,
                                                         <link linkend="gsize">gsize</link> *length,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);


</synopsis>
</refsynopsisdiv>

<refsect1 role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----<link linkend="GInputStream">GInputStream</link>
         +----<link linkend="GFilterInputStream">GFilterInputStream</link>
               +----<link linkend="GBufferedInputStream">GBufferedInputStream</link>
                     +----GDataInputStream
</synopsis>

</refsect1>





<refsect1 role="properties">
<title role="properties.title">Properties</title>
<synopsis>

  &quot;<link linkend="GDataInputStream--byte-order">byte-order</link>&quot;               <link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link>  : Read / Write
  &quot;<link linkend="GDataInputStream--newline-type">newline-type</link>&quot;             <link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link>  : Read / Write
</synopsis>
</refsect1>



<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
Data input stream implements <link linkend="GInputStream"><type>GInputStream</type></link> and includes functions for 
reading structured data directly from a binary input stream.</para>
<para>

</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="GDataInputStream-struct" role="struct"/>GDataInputStream</title>
<indexterm><primary>GDataInputStream</primary></indexterm><programlisting>typedef struct _GDataInputStream GDataInputStream;</programlisting>
<para>
An implementation of <link linkend="GBufferedInputStream"><type>GBufferedInputStream</type></link> that allows for high-level 
data manipulation of arbitrary data (including binary operations).</para>
<para>

</para><variablelist role="struct">
</variablelist></refsect2>
<refsect2>
<title><anchor id="GDataStreamByteOrder" role="enum"/>enum GDataStreamByteOrder</title>
<indexterm><primary>GDataStreamByteOrder</primary></indexterm><programlisting>typedef enum  {
  G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN,
  G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN,
  G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN
} GDataStreamByteOrder;
</programlisting>
<para>
<link linkend="GDataStreamByteOrder"><type>GDataStreamByteOrder</type></link> is used to ensure proper endianness of streaming data sources
across various machine architectures.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="G-DATA-STREAM-BYTE-ORDER-BIG-ENDIAN:CAPS" role="constant"/><literal>G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN</literal></term>
<listitem><simpara> Selects Big Endian byte order. 
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-DATA-STREAM-BYTE-ORDER-LITTLE-ENDIAN:CAPS" role="constant"/><literal>G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN</literal></term>
<listitem><simpara> Selects Little Endian byte order.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-DATA-STREAM-BYTE-ORDER-HOST-ENDIAN:CAPS" role="constant"/><literal>G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN</literal></term>
<listitem><simpara> Selects endianness based on host machine's architecture.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="GDataStreamNewlineType" role="enum"/>enum GDataStreamNewlineType</title>
<indexterm><primary>GDataStreamNewlineType</primary></indexterm><programlisting>typedef enum  {
  G_DATA_STREAM_NEWLINE_TYPE_LF,
  G_DATA_STREAM_NEWLINE_TYPE_CR,
  G_DATA_STREAM_NEWLINE_TYPE_CR_LF,
  G_DATA_STREAM_NEWLINE_TYPE_ANY
} GDataStreamNewlineType;
</programlisting>
<para>
<link linkend="GDataStreamNewlineType"><type>GDataStreamNewlineType</type></link> is used when checking for or setting the line endings for a given file.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="G-DATA-STREAM-NEWLINE-TYPE-LF:CAPS" role="constant"/><literal>G_DATA_STREAM_NEWLINE_TYPE_LF</literal></term>
<listitem><simpara> Selects "LF" line endings, common on most modern UNIX platforms.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-DATA-STREAM-NEWLINE-TYPE-CR:CAPS" role="constant"/><literal>G_DATA_STREAM_NEWLINE_TYPE_CR</literal></term>
<listitem><simpara> Selects "CR" line endings.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-DATA-STREAM-NEWLINE-TYPE-CR-LF:CAPS" role="constant"/><literal>G_DATA_STREAM_NEWLINE_TYPE_CR_LF</literal></term>
<listitem><simpara> Selects "CR, LF" line ending, common on Microsoft Windows.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-DATA-STREAM-NEWLINE-TYPE-ANY:CAPS" role="constant"/><literal>G_DATA_STREAM_NEWLINE_TYPE_ANY</literal></term>
<listitem><simpara> Automatically try to handle any line ending type.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-new" role="function"/>g_data_input_stream_new ()</title>
<indexterm><primary>g_data_input_stream_new</primary></indexterm><programlisting><link linkend="GDataInputStream">GDataInputStream</link>*   g_data_input_stream_new             (<link linkend="GInputStream">GInputStream</link> *base_stream);</programlisting>
<para>
Creates a new data input stream for the <parameter>base_stream</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>base_stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GInputStream"><type>GInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-set-byte-order" role="function"/>g_data_input_stream_set_byte_order ()</title>
<indexterm><primary>g_data_input_stream_set_byte_order</primary></indexterm><programlisting><link linkend="void">void</link>                g_data_input_stream_set_byte_order  (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link> order);</programlisting>
<para>
This function sets the byte order for the given <parameter>stream</parameter>. All subsequent
reads from the <parameter>stream</parameter> will be read in the given <parameter>order</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>order</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GDataStreamByteOrder"><type>GDataStreamByteOrder</type></link> to set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-get-byte-order" role="function"/>g_data_input_stream_get_byte_order ()</title>
<indexterm><primary>g_data_input_stream_get_byte_order</primary></indexterm><programlisting><link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link> g_data_input_stream_get_byte_order (<link linkend="GDataInputStream">GDataInputStream</link> *stream);</programlisting>
<para>
Gets the byte order for the data input stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the <parameter>stream</parameter>'s current <link linkend="GDataStreamByteOrder"><type>GDataStreamByteOrder</type></link>. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-set-newline-type" role="function"/>g_data_input_stream_set_newline_type ()</title>
<indexterm><primary>g_data_input_stream_set_newline_type</primary></indexterm><programlisting><link linkend="void">void</link>                g_data_input_stream_set_newline_type
                                                        (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link> type);</programlisting>
<para>
Sets the newline type for the <parameter>stream</parameter>.
</para>
<para>
Note that using G_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.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>type</parameter>&nbsp;:</term>
<listitem><simpara> the type of new line return as <link linkend="GDataStreamNewlineType"><type>GDataStreamNewlineType</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-get-newline-type" role="function"/>g_data_input_stream_get_newline_type ()</title>
<indexterm><primary>g_data_input_stream_get_newline_type</primary></indexterm><programlisting><link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link> g_data_input_stream_get_newline_type
                                                        (<link linkend="GDataInputStream">GDataInputStream</link> *stream);</programlisting>
<para>
Gets the current newline type for the <parameter>stream</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="GDataStreamNewlineType"><type>GDataStreamNewlineType</type></link> for the given <parameter>stream</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-byte" role="function"/>g_data_input_stream_read_byte ()</title>
<indexterm><primary>g_data_input_stream_read_byte</primary></indexterm><programlisting><link linkend="guchar">guchar</link>              g_data_input_stream_read_byte       (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads an unsigned 8-bit/1-byte value from <parameter>stream</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> an unsigned 8-bit/1-byte value read from the <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> 
if an error occurred.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-int16" role="function"/>g_data_input_stream_read_int16 ()</title>
<indexterm><primary>g_data_input_stream_read_int16</primary></indexterm><programlisting><link linkend="gint16">gint16</link>              g_data_input_stream_read_int16      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads a 16-bit/2-byte value from <parameter>stream</parameter>.
</para>
<para>
In order to get the correct byte order for this read operation, 
see <link linkend="g-data-stream-get-byte-order"><function>g_data_stream_get_byte_order()</function></link> and <link linkend="g-data-stream-set-byte-order"><function>g_data_stream_set_byte_order()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a signed 16-bit/2-byte value read from <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> if 
an error occurred.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-uint16" role="function"/>g_data_input_stream_read_uint16 ()</title>
<indexterm><primary>g_data_input_stream_read_uint16</primary></indexterm><programlisting><link linkend="guint16">guint16</link>             g_data_input_stream_read_uint16     (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads an unsigned 16-bit/2-byte value from <parameter>stream</parameter>.
</para>
<para>
In order to get the correct byte order for this read operation, 
see <link linkend="g-data-stream-get-byte-order"><function>g_data_stream_get_byte_order()</function></link> and <link linkend="g-data-stream-set-byte-order"><function>g_data_stream_set_byte_order()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> an unsigned 16-bit/2-byte value read from the <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> if 
an error occurred. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-int32" role="function"/>g_data_input_stream_read_int32 ()</title>
<indexterm><primary>g_data_input_stream_read_int32</primary></indexterm><programlisting><link linkend="gint32">gint32</link>              g_data_input_stream_read_int32      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads a signed 32-bit/4-byte value from <parameter>stream</parameter>.
</para>
<para>
In order to get the correct byte order for this read operation, 
see <link linkend="g-data-stream-get-byte-order"><function>g_data_stream_get_byte_order()</function></link> and <link linkend="g-data-stream-set-byte-order"><function>g_data_stream_set_byte_order()</function></link>.
</para>
<para>
If <parameter>cancellable</parameter> is not <link linkend="NULL:CAPS"><literal>NULL</literal></link>, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error <link linkend="G-IO-ERROR-CANCELLED:CAPS"><literal>G_IO_ERROR_CANCELLED</literal></link> will be returned.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a signed 32-bit/4-byte value read from the <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> if 
an error occurred. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-uint32" role="function"/>g_data_input_stream_read_uint32 ()</title>
<indexterm><primary>g_data_input_stream_read_uint32</primary></indexterm><programlisting><link linkend="guint32">guint32</link>             g_data_input_stream_read_uint32     (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads an unsigned 32-bit/4-byte value from <parameter>stream</parameter>.
</para>
<para>
In order to get the correct byte order for this read operation, 
see <link linkend="g-data-stream-get-byte-order"><function>g_data_stream_get_byte_order()</function></link> and <link linkend="g-data-stream-set-byte-order"><function>g_data_stream_set_byte_order()</function></link>.
</para>
<para>
If <parameter>cancellable</parameter> is not <link linkend="NULL:CAPS"><literal>NULL</literal></link>, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error <link linkend="G-IO-ERROR-CANCELLED:CAPS"><literal>G_IO_ERROR_CANCELLED</literal></link> will be returned.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> an unsigned 32-bit/4-byte value read from the <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> if 
an error occurred. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-int64" role="function"/>g_data_input_stream_read_int64 ()</title>
<indexterm><primary>g_data_input_stream_read_int64</primary></indexterm><programlisting><link linkend="gint64">gint64</link>              g_data_input_stream_read_int64      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads a 64-bit/8-byte value from <parameter>stream</parameter>.
</para>
<para>
In order to get the correct byte order for this read operation, 
see <link linkend="g-data-stream-get-byte-order"><function>g_data_stream_get_byte_order()</function></link> and <link linkend="g-data-stream-set-byte-order"><function>g_data_stream_set_byte_order()</function></link>.
</para>
<para>
If <parameter>cancellable</parameter> is not <link linkend="NULL:CAPS"><literal>NULL</literal></link>, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error <link linkend="G-IO-ERROR-CANCELLED:CAPS"><literal>G_IO_ERROR_CANCELLED</literal></link> will be returned.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a signed 64-bit/8-byte value read from <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> if 
an error occurred.  
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-uint64" role="function"/>g_data_input_stream_read_uint64 ()</title>
<indexterm><primary>g_data_input_stream_read_uint64</primary></indexterm><programlisting><link linkend="guint64">guint64</link>             g_data_input_stream_read_uint64     (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads an unsigned 64-bit/8-byte value from <parameter>stream</parameter>.
</para>
<para>
In order to get the correct byte order for this read operation, 
see <link linkend="g-data-stream-get-byte-order"><function>g_data_stream_get_byte_order()</function></link>.
</para>
<para>
If <parameter>cancellable</parameter> is not <link linkend="NULL:CAPS"><literal>NULL</literal></link>, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error <link linkend="G-IO-ERROR-CANCELLED:CAPS"><literal>G_IO_ERROR_CANCELLED</literal></link> will be returned.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> an unsigned 64-bit/8-byte read from <parameter>stream</parameter> or <link linkend="0:CAPS"><literal>0</literal></link> if 
an error occurred. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-line" role="function"/>g_data_input_stream_read_line ()</title>
<indexterm><primary>g_data_input_stream_read_line</primary></indexterm><programlisting><link linkend="char">char</link>*               g_data_input_stream_read_line       (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         <link linkend="gsize">gsize</link> *length,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads a line from the data input stream.
</para>
<para>
If <parameter>cancellable</parameter> is not <link linkend="NULL:CAPS"><literal>NULL</literal></link>, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error <link linkend="G-IO-ERROR-CANCELLED:CAPS"><literal>G_IO_ERROR_CANCELLED</literal></link> will be returned.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="gsize"><type>gsize</type></link> to get the length of the data read in.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a string with the line that was read in (including the newlines).
Set <parameter>length</parameter> to a <link linkend="gsize"><type>gsize</type></link> to get the length of the read line. Returns <link linkend="NULL:CAPS"><literal>NULL</literal></link> on an error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-data-input-stream-read-until" role="function"/>g_data_input_stream_read_until ()</title>
<indexterm><primary>g_data_input_stream_read_until</primary></indexterm><programlisting><link linkend="char">char</link>*               g_data_input_stream_read_until      (<link linkend="GDataInputStream">GDataInputStream</link> *stream,
                                                         const <link linkend="gchar">gchar</link> *stop_chars,
                                                         <link linkend="gsize">gsize</link> *length,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Reads a string from the data input stream, up to the first 
occurrance of any of the stop characters.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> a given <link linkend="GDataInputStream"><type>GDataInputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stop_chars</parameter>&nbsp;:</term>
<listitem><simpara> characters to terminate the read.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="gsize"><type>gsize</type></link> to get the length of the data read in.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&nbsp;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link> for error reporting.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a string with the data that was read before encountering 
any of the stop characters. Set <parameter>length</parameter> to a <link linkend="gsize"><type>gsize</type></link> to get the length 
of the string. This function will return <link linkend="NULL:CAPS"><literal>NULL</literal></link> on an error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2><title><anchor id="GDataInputStream--byte-order"/>The <literal>&quot;byte-order&quot;</literal> property</title>
<indexterm><primary>GDataInputStream:byte-order</primary></indexterm><programlisting>  &quot;byte-order&quot;               <link linkend="GDataStreamByteOrder">GDataStreamByteOrder</link>  : Read / Write</programlisting>
<para>The byte order.</para><para>Default value: G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN</para>
</refsect2>
<refsect2><title><anchor id="GDataInputStream--newline-type"/>The <literal>&quot;newline-type&quot;</literal> property</title>
<indexterm><primary>GDataInputStream:newline-type</primary></indexterm><programlisting>  &quot;newline-type&quot;             <link linkend="GDataStreamNewlineType">GDataStreamNewlineType</link>  : Read / Write</programlisting>
<para>The accepted types of line ending.</para><para>Default value: G_DATA_STREAM_NEWLINE_TYPE_LF</para>
</refsect2>

</refsect1>



<refsect1>
<title>See Also</title>
<link linkend="GInputStream"><type>GInputStream</type></link>
</refsect1>


<refsect1><refsect2 /><refsect2 /></refsect1>
</refentry>
