Synopsis#include <gio/gio.h> GDataInputStream; enum GDataStreamByteOrder; enum GDataStreamNewlineType; GDataInputStream* g_data_input_stream_new (GInputStream *base_stream); void g_data_input_stream_set_byte_order (GDataInputStream *stream, GDataStreamByteOrder order); GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream); void g_data_input_stream_set_newline_type (GDataInputStream *stream, GDataStreamNewlineType type); GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream); guchar g_data_input_stream_read_byte (GDataInputStream *stream, GCancellable *cancellable, GError **error); gint16 g_data_input_stream_read_int16 (GDataInputStream *stream, GCancellable *cancellable, GError **error); guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream, GCancellable *cancellable, GError **error); gint32 g_data_input_stream_read_int32 (GDataInputStream *stream, GCancellable *cancellable, GError **error); guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream, GCancellable *cancellable, GError **error); gint64 g_data_input_stream_read_int64 (GDataInputStream *stream, GCancellable *cancellable, GError **error); guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream, GCancellable *cancellable, GError **error); char* g_data_input_stream_read_line (GDataInputStream *stream, gsize *length, GCancellable *cancellable, GError **error); char* g_data_input_stream_read_until (GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error); Object HierarchyGObject +----GInputStream +----GFilterInputStream +----GBufferedInputStream +----GDataInputStream Properties"byte-order" GDataStreamByteOrder : Read / Write "newline-type" GDataStreamNewlineType : Read / Write DescriptionData input stream implements GInputStream and includes functions for reading structured data directly from a binary input stream.
DetailsGDataInputStreamtypedef struct _GDataInputStream GDataInputStream; An implementation of GBufferedInputStream that allows for high-level data manipulation of arbitrary data (including binary operations).
enum GDataStreamByteOrdertypedef enum { G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN, G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN } GDataStreamByteOrder; GDataStreamByteOrder is used to ensure proper endianness of streaming data sources across various machine architectures.
enum GDataStreamNewlineTypetypedef 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; GDataStreamNewlineType is used when checking for or setting the line endings for a given file.
g_data_input_stream_new ()GDataInputStream* g_data_input_stream_new (GInputStream *base_stream);
Creates a new data input stream for the
g_data_input_stream_set_byte_order ()void g_data_input_stream_set_byte_order (GDataInputStream *stream, GDataStreamByteOrder order);
This function sets the byte order for the given
g_data_input_stream_get_byte_order ()GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream); Gets the byte order for the data input stream.
g_data_input_stream_set_newline_type ()void g_data_input_stream_set_newline_type (GDataInputStream *stream, GDataStreamNewlineType type);
Sets the newline type for the 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.
g_data_input_stream_get_newline_type ()GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
Gets the current newline type for the
g_data_input_stream_read_byte ()guchar g_data_input_stream_read_byte (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads an unsigned 8-bit/1-byte value from
g_data_input_stream_read_int16 ()gint16 g_data_input_stream_read_int16 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads a 16-bit/2-byte value from
In order to get the correct byte order for this read operation,
see
g_data_input_stream_read_uint16 ()guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads an unsigned 16-bit/2-byte value from
In order to get the correct byte order for this read operation,
see
g_data_input_stream_read_int32 ()gint32 g_data_input_stream_read_int32 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads a signed 32-bit/4-byte value from
In order to get the correct byte order for this read operation,
see
If
g_data_input_stream_read_uint32 ()guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads an unsigned 32-bit/4-byte value from
In order to get the correct byte order for this read operation,
see
If
g_data_input_stream_read_int64 ()gint64 g_data_input_stream_read_int64 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads a 64-bit/8-byte value from
In order to get the correct byte order for this read operation,
see
If
g_data_input_stream_read_uint64 ()guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
Reads an unsigned 64-bit/8-byte value from
In order to get the correct byte order for this read operation,
see
If
g_data_input_stream_read_line ()char* g_data_input_stream_read_line (GDataInputStream *stream, gsize *length, GCancellable *cancellable, GError **error); Reads a line from the data input stream.
If
g_data_input_stream_read_until ()char* g_data_input_stream_read_until (GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error); Reads a string from the data input stream, up to the first occurrance of any of the stop characters.
Property DetailsThe
|