GDataOutputStream

## GDataOutputStream GDataOutputStream — Data Output Stream |

## Synopsis

    #include <gio/gio.h>

    struct              GDataOutputStream;
    GDataOutputStream * g_data_output_stream_new            (GOutputStream *base_stream);
    void                g_data_output_stream_set_byte_order (GDataOutputStream *stream,
                                                             GDataStreamByteOrder order);
    GDataStreamByteOrder g_data_output_stream_get_byte_order
                                                            (GDataOutputStream *stream);
    gboolean            g_data_output_stream_put_byte       (GDataOutputStream *stream,
                                                             guchar data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_int16      (GDataOutputStream *stream,
                                                             gint16 data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_uint16     (GDataOutputStream *stream,
                                                             guint16 data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_int32      (GDataOutputStream *stream,
                                                             gint32 data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_uint32     (GDataOutputStream *stream,
                                                             guint32 data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_int64      (GDataOutputStream *stream,
                                                             gint64 data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_uint64     (GDataOutputStream *stream,
                                                             guint64 data,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            g_data_output_stream_put_string     (GDataOutputStream *stream,
                                                             const char *str,
                                                             GCancellable *cancellable,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----GOutputStream
             +----GFilterOutputStream
                   +----GDataOutputStream

## Properties

      "byte-order"               GDataStreamByteOrder  : Read / Write

## Description

Data output stream implements GOutputStream and includes functions for writing data directly to an output stream.

## Details

### struct GDataOutputStream

    struct GDataOutputStream;

An implementation of GBufferedOutputStream that allows for high-level data manipulation of arbitrary data (including binary operations).

### g_data_output_stream_new ()

    GDataOutputStream * g_data_output_stream_new            (GOutputStream *base_stream);

Creates a new data output stream for `base_stream`.

`base_stream` : | a GOutputStream.
Returns : | GDataOutputStream.

### g_data_output_stream_set_byte_order ()

    void                g_data_output_stream_set_byte_order (GDataOutputStream *stream,
                                                             GDataStreamByteOrder order);

Sets the byte order of the data output stream to `order`.

`stream` : | a GDataOutputStream.
`order` : | a `GDataStreamByteOrder`.

### g_data_output_stream_get_byte_order ()

    GDataStreamByteOrder g_data_output_stream_get_byte_order
                                                            (GDataOutputStream *stream);

Gets the byte order for the stream.

`stream` : | a GDataOutputStream.
Returns : | the GDataStreamByteOrder for the `stream`.

### g_data_output_stream_put_byte ()

    gboolean            g_data_output_stream_put_byte       (GDataOutputStream *stream,
                                                             guchar data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts a byte into the output stream.

`stream` : | a GDataOutputStream.
`data` : | a guchar.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_int16 ()

    gboolean            g_data_output_stream_put_int16      (GDataOutputStream *stream,
                                                             gint16 data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts a signed 16-bit integer into the output stream.

`stream` : | a GDataOutputStream.
`data` : | a gint16.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_uint16 ()

    gboolean            g_data_output_stream_put_uint16     (GDataOutputStream *stream,
                                                             guint16 data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts an unsigned 16-bit integer into the output stream.

`stream` : | a GDataOutputStream.
`data` : | a guint16.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_int32 ()

    gboolean            g_data_output_stream_put_int32      (GDataOutputStream *stream,
                                                             gint32 data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts a signed 32-bit integer into the output stream.

`stream` : | a GDataOutputStream.
`data` : | a gint32.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_uint32 ()

    gboolean            g_data_output_stream_put_uint32     (GDataOutputStream *stream,
                                                             guint32 data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts an unsigned 32-bit integer into the stream.

`stream` : | a GDataOutputStream.
`data` : | a guint32.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_int64 ()

    gboolean            g_data_output_stream_put_int64      (GDataOutputStream *stream,
                                                             gint64 data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts a signed 64-bit integer into the stream.

`stream` : | a GDataOutputStream.
`data` : | a gint64.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_uint64 ()

    gboolean            g_data_output_stream_put_uint64     (GDataOutputStream *stream,
                                                             guint64 data,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts an unsigned 64-bit integer into the stream.

`stream` : | a GDataOutputStream.
`data` : | a guint64.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `data` was successfully added to the `stream`.

### g_data_output_stream_put_string ()

    gboolean            g_data_output_stream_put_string     (GDataOutputStream *stream,
                                                             const char *str,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts a string into the output stream.

`stream` : | a GDataOutputStream.
`str` : | a string.
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`error` : | a GError, `NULL` to ignore.
Returns : | `TRUE` if `string` was successfully added to the `stream`.

## Property Details

### The `"byte-order"` property

      "byte-order"               GDataStreamByteOrder  : Read / Write

Determines the byte ordering that is used when writing multi-byte entities (such as integers) to the stream.

Default value: G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN

## See Also

GOutputStream