<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="GBufferedOutputStream">
<refmeta>
<refentrytitle role="top_of_page" id="GBufferedOutputStream.top_of_page">GBufferedOutputStream</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GIO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GBufferedOutputStream</refname>
<refpurpose>Buffered Output Stream</refpurpose>
</refnamediv>

<refsynopsisdiv id="GBufferedOutputStream.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gio/gio.h&gt;

                    <link linkend="GBufferedOutputStream-struct">GBufferedOutputStream</link>;
<link linkend="GOutputStream">GOutputStream</link>*      <link linkend="g-buffered-output-stream-new">g_buffered_output_stream_new</link>        (<link linkend="GOutputStream">GOutputStream</link> *base_stream);
<link linkend="GOutputStream">GOutputStream</link>*      <link linkend="g-buffered-output-stream-new-sized">g_buffered_output_stream_new_sized</link>  (<link linkend="GOutputStream">GOutputStream</link> *base_stream,
                                                         <link linkend="gsize">gsize</link> size);
<link linkend="gsize">gsize</link>               <link linkend="g-buffered-output-stream-get-buffer-size">g_buffered_output_stream_get_buffer_size</link>
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream);
<link linkend="void">void</link>                <link linkend="g-buffered-output-stream-set-buffer-size">g_buffered_output_stream_set_buffer_size</link>
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream,
                                                         <link linkend="gsize">gsize</link> size);
<link linkend="gboolean">gboolean</link>            <link linkend="g-buffered-output-stream-get-auto-grow">g_buffered_output_stream_get_auto_grow</link>
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream);
<link linkend="void">void</link>                <link linkend="g-buffered-output-stream-set-auto-grow">g_buffered_output_stream_set_auto_grow</link>
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream,
                                                         <link linkend="gboolean">gboolean</link> auto_grow);
</synopsis>
</refsynopsisdiv>

<refsect1 id="GBufferedOutputStream.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----<link linkend="GOutputStream">GOutputStream</link>
         +----<link linkend="GFilterOutputStream">GFilterOutputStream</link>
               +----GBufferedOutputStream
</synopsis>
</refsect1>





<refsect1 id="GBufferedOutputStream.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GBufferedOutputStream--auto-grow">auto-grow</link>&quot;                <link linkend="gboolean">gboolean</link>              : Read / Write
  &quot;<link linkend="GBufferedOutputStream--buffer-size">buffer-size</link>&quot;              <link linkend="guint">guint</link>                 : Read / Write / Construct
</synopsis>
</refsect1>



<refsect1 id="GBufferedOutputStream.description" role="desc">
<title role="desc.title">Description</title>
<para>
Buffered output stream implements <link linkend="GFilterOutputStream"><type>GFilterOutputStream</type></link> and provides 
for buffered writes. 
</para>
<para>
By default, <link linkend="GBufferedOutputStream"><type>GBufferedOutputStream</type></link>'s buffer size is set at 4 kilobytes.
</para>
<para>
To create a buffered output stream, use <link linkend="g-buffered-output-stream-new"><function>g_buffered_output_stream_new()</function></link>, 
or <link linkend="g-buffered-output-stream-new-sized"><function>g_buffered_output_stream_new_sized()</function></link> to specify the buffer's size 
at construction.
</para>
<para>
To get the size of a buffer within a buffered input stream, use 
<link linkend="g-buffered-output-stream-get-buffer-size"><function>g_buffered_output_stream_get_buffer_size()</function></link>. To change the size of a 
buffered output stream's buffer, use 
<link linkend="g-buffered-output-stream-set-buffer-size"><function>g_buffered_output_stream_set_buffer_size()</function></link>. Note that the buffer's 
size cannot be reduced below the size of the data within the buffer.</para>
<para>
</para>
</refsect1>

<refsect1 id="GBufferedOutputStream.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GBufferedOutputStream-struct" role="struct">
<title>GBufferedOutputStream</title>
<indexterm zone="GBufferedOutputStream-struct"><primary sortas="BufferedOutputStream">GBufferedOutputStream</primary></indexterm><programlisting>typedef struct _GBufferedOutputStream GBufferedOutputStream;</programlisting>
<para>
An implementation of <link linkend="GFilterOutputStream"><type>GFilterOutputStream</type></link> with a sized buffer.</para>
<para>
</para><variablelist role="struct">
</variablelist></refsect2>
<refsect2 id="g-buffered-output-stream-new" role="function">
<title>g_buffered_output_stream_new ()</title>
<indexterm zone="g-buffered-output-stream-new"><primary sortas="buffered_output_stream_new">g_buffered_output_stream_new</primary></indexterm><programlisting><link linkend="GOutputStream">GOutputStream</link>*      g_buffered_output_stream_new        (<link linkend="GOutputStream">GOutputStream</link> *base_stream);</programlisting>
<para>
Creates a new buffered output stream for a base stream.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>base_stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GOutputStream"><type>GOutputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GOutputStream"><type>GOutputStream</type></link> for the given <parameter>base_stream</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-buffered-output-stream-new-sized" role="function">
<title>g_buffered_output_stream_new_sized ()</title>
<indexterm zone="g-buffered-output-stream-new-sized"><primary sortas="buffered_output_stream_new_sized">g_buffered_output_stream_new_sized</primary></indexterm><programlisting><link linkend="GOutputStream">GOutputStream</link>*      g_buffered_output_stream_new_sized  (<link linkend="GOutputStream">GOutputStream</link> *base_stream,
                                                         <link linkend="gsize">gsize</link> size);</programlisting>
<para>
Creates a new buffered output stream with a given buffer size.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>base_stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GOutputStream"><type>GOutputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>size</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gsize"><type>gsize</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GOutputStream"><type>GOutputStream</type></link> with an internal buffer set to <parameter>size</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-buffered-output-stream-get-buffer-size" role="function">
<title>g_buffered_output_stream_get_buffer_size ()</title>
<indexterm zone="g-buffered-output-stream-get-buffer-size"><primary sortas="buffered_output_stream_get_buffer_size">g_buffered_output_stream_get_buffer_size</primary></indexterm><programlisting><link linkend="gsize">gsize</link>               g_buffered_output_stream_get_buffer_size
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream);</programlisting>
<para>
Gets the size of the buffer in the <parameter>stream</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GBufferedOutputStream"><type>GBufferedOutputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the current size of the buffer.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-buffered-output-stream-set-buffer-size" role="function">
<title>g_buffered_output_stream_set_buffer_size ()</title>
<indexterm zone="g-buffered-output-stream-set-buffer-size"><primary sortas="buffered_output_stream_set_buffer_size">g_buffered_output_stream_set_buffer_size</primary></indexterm><programlisting><link linkend="void">void</link>                g_buffered_output_stream_set_buffer_size
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream,
                                                         <link linkend="gsize">gsize</link> size);</programlisting>
<para>
Sets the size of the internal buffer to <parameter>size</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GBufferedOutputStream"><type>GBufferedOutputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>size</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gsize"><type>gsize</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-buffered-output-stream-get-auto-grow" role="function">
<title>g_buffered_output_stream_get_auto_grow ()</title>
<indexterm zone="g-buffered-output-stream-get-auto-grow"><primary sortas="buffered_output_stream_get_auto_grow">g_buffered_output_stream_get_auto_grow</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_buffered_output_stream_get_auto_grow
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream);</programlisting>
<para>
Checks if the buffer automatically grows as data is added.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GBufferedOutputStream"><type>GBufferedOutputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the <parameter>stream</parameter>'s buffer automatically grows,
<link linkend="FALSE--CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-buffered-output-stream-set-auto-grow" role="function">
<title>g_buffered_output_stream_set_auto_grow ()</title>
<indexterm zone="g-buffered-output-stream-set-auto-grow"><primary sortas="buffered_output_stream_set_auto_grow">g_buffered_output_stream_set_auto_grow</primary></indexterm><programlisting><link linkend="void">void</link>                g_buffered_output_stream_set_auto_grow
                                                        (<link linkend="GBufferedOutputStream">GBufferedOutputStream</link> *stream,
                                                         <link linkend="gboolean">gboolean</link> auto_grow);</programlisting>
<para>
Sets whether or not the <parameter>stream</parameter>'s buffer should automatically grow.
If <parameter>auto_grow</parameter> 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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GBufferedOutputStream"><type>GBufferedOutputStream</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>auto_grow</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gboolean"><type>gboolean</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GBufferedOutputStream.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GBufferedOutputStream--auto-grow" role="property"><title>The <literal>&quot;auto-grow&quot;</literal> property</title>
<indexterm zone="GBufferedOutputStream--auto-grow"><primary sortas="BufferedOutputStream:auto-grow">GBufferedOutputStream:auto-grow</primary></indexterm><programlisting>  &quot;auto-grow&quot;                <link linkend="gboolean">gboolean</link>              : Read / Write</programlisting>
<para>Whether the buffer should automatically grow.</para><para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GBufferedOutputStream--buffer-size" role="property"><title>The <literal>&quot;buffer-size&quot;</literal> property</title>
<indexterm zone="GBufferedOutputStream--buffer-size"><primary sortas="BufferedOutputStream:buffer-size">GBufferedOutputStream:buffer-size</primary></indexterm><programlisting>  &quot;buffer-size&quot;              <link linkend="guint">guint</link>                 : Read / Write / Construct</programlisting>
<para>The size of the backend buffer.</para><para>Allowed values: &gt;= 1</para>
<para>Default value: 4096</para>
</refsect2>
</refsect1>



<refsect1 id="GBufferedOutputStream.see-also">
<title>See Also</title>
#GFilterOutputStream, <link linkend="GOutputStream"><type>GOutputStream</type></link>
</refsect1>

</refentry>
