![]() |
![]() |
![]() |
GIO Reference Manual | ![]() |
---|---|---|---|---|
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 *data_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, gchar stop_char, gsize *length, GCancellable *cancellable, GError **error);
GObject +----GInputStream +----GFilterInputStream +----GBufferedInputStream +----GDataInputStream
typedef enum { G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN, G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN } GDataStreamByteOrder;
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;
GDataInputStream* g_data_input_stream_new (GInputStream *base_stream);
|
a given GInputStream. |
Returns : |
a new GDataInputStream. |
void g_data_input_stream_set_byte_order (GDataInputStream *stream, GDataStreamByteOrder order);
This function sets the byte order for the given stream
. All subsequent
reads from the stream
will be read in the given order
.
|
a given GDataInputStream. |
|
a GDataStreamByteOrder to set. |
GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
|
a given GDataInputStream. |
Returns : |
the stream 's current GDataStreamByteOrder.
|
void g_data_input_stream_set_newline_type (GDataInputStream *data_stream, GDataStreamNewlineType type);
Sets the newline type for the stream
.
TODO: is it valid to set this to G_DATA_STREAM_NEWLINE_TYPE_ANY, or should it always be set to {_LF, _CR, _CR_LF}
|
|
|
the type of new line return as GDataStreamNewlineType. |
GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
Gets the current newline type for the stream
.
|
a given GDataInputStream. |
Returns : |
GDataStreamNewlineType for the given stream .
|
guchar g_data_input_stream_read_byte (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
and g_data_stream_set_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
an unsigned 8-bit/1-byte value read from the stream or 0
if an error occured.
|
gint16 g_data_input_stream_read_int16 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
and g_data_stream_set_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
a signed 16-bit/2-byte value read from stream or 0 if
an error occured.
|
guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
and g_data_stream_set_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
an unsigned 16-bit/2-byte value read from the stream or 0 if
an error occured.
|
gint32 g_data_input_stream_read_int32 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
and g_data_stream_set_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
a signed 32-bit/4-byte value read from the stream or 0 if
an error occured.
|
guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
and g_data_stream_set_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
an unsigned 32-bit/4-byte value read from the stream or 0 if
an error occured.
|
gint64 g_data_input_stream_read_int64 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
and g_data_stream_set_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
a signed 64-bit/8-byte value read from stream or 0 if
an error occured.
|
guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream, GCancellable *cancellable, GError **error);
In order to get the correct byte order for this read operation,
see g_data_stream_get_byte_order()
.
|
a given GDataInputStream. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
an unsigned 64-bit/8-byte read from stream or 0 if
an error occured.
|
char* g_data_input_stream_read_line (GDataInputStream *stream, gsize *length, GCancellable *cancellable, GError **error);
|
a given GDataInputStream. |
|
a gsize to get the length of the data read in. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
a string with the line that was read in. Set length to
a gsize to get the length of the read line. This function will
return NULL on an error.
|
char* g_data_input_stream_read_until (GDataInputStream *stream, gchar stop_char, gsize *length, GCancellable *cancellable, GError **error);
NOTE: not supported for GDataInputStream.
|
a given GDataInputStream. |
|
character to terminate the read. |
|
a gsize to get the length of the data read in. |
|
optional GCancellable object, NULL to ignore.
|
|
GError for error reporting. |
Returns : |
NULL .
|