## GBufferedOutputStream

GBufferedOutputStream — Buffered Output Stream

## Synopsis

    #include <gio/gio.h>

                        GBufferedOutputStream;
    GOutputStream *     g_buffered_output_stream_new        (GOutputStream *base_stream);
    GOutputStream *     g_buffered_output_stream_new_sized  (GOutputStream *base_stream,
                                                             gsize size);
    gsize               g_buffered_output_stream_get_buffer_size
                                                            (GBufferedOutputStream *stream);
    void                g_buffered_output_stream_set_buffer_size
                                                            (GBufferedOutputStream *stream,
                                                             gsize size);
    gboolean            g_buffered_output_stream_get_auto_grow
                                                            (GBufferedOutputStream *stream);
    void                g_buffered_output_stream_set_auto_grow
                                                            (GBufferedOutputStream *stream,
                                                             gboolean auto_grow);

## Object Hierarchy

      GObject
       +----GOutputStream
             +----GFilterOutputStream
                   +----GBufferedOutputStream

## Implemented Interfaces

GBufferedOutputStream implements GSeekable.

## Properties

      "auto-grow"                gboolean              : Read / Write
      "buffer-size"              guint                 : Read / Write / Construct

## Description

Buffered output stream implements GFilterOutputStream and provides for buffered writes.

By default, GBufferedOutputStream's buffer size is set at 4 kilobytes.

To create a buffered output stream, use `g_buffered_output_stream_new()`, or `g_buffered_output_stream_new_sized()` to specify the buffer's size at construction.

To get the size of a buffer within a buffered input stream, use `g_buffered_output_stream_get_buffer_size()`. To change the size of a buffered output stream's buffer, use `g_buffered_output_stream_set_buffer_size()`. Note that the buffer's size cannot be reduced below the size of the data within the buffer.

## Details

### GBufferedOutputStream

    typedef struct _GBufferedOutputStream GBufferedOutputStream;

An implementation of GFilterOutputStream with a sized buffer.

### g_buffered_output_stream_new ()

    GOutputStream *     g_buffered_output_stream_new        (GOutputStream *base_stream);

Creates a new buffered output stream for a base stream.

`base_stream` : | a GOutputStream.
Returns : | a GOutputStream for the given `base_stream`.

### g_buffered_output_stream_new_sized ()

    GOutputStream *     g_buffered_output_stream_new_sized  (GOutputStream *base_stream,
                                                             gsize size);

Creates a new buffered output stream with a given buffer size.

`base_stream` : | a GOutputStream.
`size` : | a gsize.
Returns : | a GOutputStream with an internal buffer set to `size`.

### g_buffered_output_stream_get_buffer_size ()

    gsize               g_buffered_output_stream_get_buffer_size
                                                            (GBufferedOutputStream *stream);

Gets the size of the buffer in the `stream`.

`stream` : | a GBufferedOutputStream.
Returns : | the current size of the buffer.

### g_buffered_output_stream_set_buffer_size ()

    void                g_buffered_output_stream_set_buffer_size
                                                            (GBufferedOutputStream *stream,
                                                             gsize size);

Sets the size of the internal buffer to `size`.

`stream` : | a GBufferedOutputStream.
`size` : | a gsize.

### g_buffered_output_stream_get_auto_grow ()

    gboolean            g_buffered_output_stream_get_auto_grow
                                                            (GBufferedOutputStream *stream);

Checks if the buffer automatically grows as data is added.

`stream` : | a GBufferedOutputStream.
Returns : | `TRUE` if the `stream`'s buffer automatically grows, `FALSE` otherwise.

### g_buffered_output_stream_set_auto_grow ()

    void                g_buffered_output_stream_set_auto_grow
                                                            (GBufferedOutputStream *stream,
                                                             gboolean auto_grow);

Sets whether or not the `stream`'s buffer should automatically grow. If `auto_grow` is true, then each write will just make the buffer larger, and you must manually flush the buffer to actually write out the data to the underlying stream.

`stream` : | a GBufferedOutputStream.
`auto_grow` : | a gboolean.

## Property Details

### The `"auto-grow"` property

      "auto-grow"                gboolean              : Read / Write

Whether the buffer should automatically grow.

Default value: FALSE

### The `"buffer-size"` property

      "buffer-size"              guint                 : Read / Write / Construct

The size of the backend buffer.

Allowed values: >= 1

Default value: 4096

## See Also

GFilterOutputStream, GOutputStream