## GDataOutputStream GDataOutputStream — Data Output Stream |

## Functions

GDataOutputStream * | g_data_output_stream_new ()
void | g_data_output_stream_set_byte_order ()
GDataStreamByteOrder | g_data_output_stream_get_byte_order ()
gboolean | g_data_output_stream_put_byte ()
gboolean | g_data_output_stream_put_int16 ()
gboolean | g_data_output_stream_put_uint16 ()
gboolean | g_data_output_stream_put_int32 ()
gboolean | g_data_output_stream_put_uint32 ()
gboolean | g_data_output_stream_put_int64 ()
gboolean | g_data_output_stream_put_uint64 ()
gboolean | g_data_output_stream_put_string ()

## Properties

GDataStreamByteOrder | byte-order | Read / Write

## Types and Values

struct | GDataOutputStream

## Object Hierarchy

        GObject
        ╰── GOutputStream
            ╰── GFilterOutputStream
                ╰── GDataOutputStream

## Implemented Interfaces

GDataOutputStream implements GSeekable.

## Includes

    #include <gio/gio.h>

## Description

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

## Functions

### g_data_output_stream_new ()

    GDataOutputStream *
    g_data_output_stream_new (GOutputStream *base_stream);

Creates a new data output stream for `base_stream` .

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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.

#### Parameters

stream | a GDataOutputStream. |
data | a guchar. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
data | a gint16. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
data | a guint16. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
data | a gint32. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
data | a guint32. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
data | a gint64. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
data | a guint64. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
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.

#### Parameters

stream | a GDataOutputStream. |
str | a string. |
cancellable | optional GCancellable object, `NULL` to ignore. | [nullable]
error | a GError, `NULL` to ignore. |

#### Returns

`TRUE` if `string` was successfully added to the `stream` .

## Types and Values

### struct GDataOutputStream

    struct GDataOutputStream;

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

## Property Details

### The `“byte-order”` property

      “byte-order”               GDataStreamByteOrder

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

Flags: Read / Write

Default value: G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN

## See Also

GOutputStream