1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
5 <refentry id="class-giobufferedoutputstream">
7 <refname>gio.BufferedOutputStream</refname>
8 <refpurpose>Buffered Output Stream</refpurpose>
12 <title>Synopsis</title>
14 <classsynopsis language="python">
15 <ooclass><classname>gio.BufferedOutputStream</classname></ooclass>
16 <ooclass><classname><link linkend="class-giofilteroutputstream">gio.FilterOutputStream</link></classname></ooclass>
18 <constructorsynopsis language="python">
19 <methodname><link linkend="constructor-giobufferedoutputstream">gio.BufferedOutputStream</link></methodname>
20 <methodparam><parameter role="keyword">base_stream</parameter></methodparam>
21 </constructorsynopsis>
23 <methodsynopsis language="python">
24 <methodname><link linkend="method-giobufferedoutputstream--get-auto-grow">get_auto_grow</link></methodname>
25 <methodparam></methodparam>
27 <methodsynopsis language="python">
28 <methodname><link linkend="method-giobufferedoutputstream--get-buffer-size">get_buffer_size</link></methodname>
29 <methodparam></methodparam>
31 <methodsynopsis language="python">
32 <methodname><link linkend="method-giobufferedoutputstream--set-auto-grow">set_auto_grow</link></methodname>
33 <methodparam><parameter role="keyword">auto_grow</parameter></methodparam>
35 <methodsynopsis language="python">
36 <methodname><link linkend="method-giobufferedoutputstream--set-buffer-size">set_buffer_size</link></methodname>
37 <methodparam><parameter role="keyword">size</parameter></methodparam>
43 <emphasis role="bold">Functions</emphasis>
45 <methodsynopsis language="python">
46 <methodname><link linkend="function-gio--buffered-output-stream-new-sized">gio.buffered_output_stream_new_sized</link></methodname>
47 <methodparam><parameter role="keyword">size</parameter></methodparam>
48 </methodsynopsis></programlisting>
53 <title>Ancestry</title>
55 <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
56 +-- <link linkend="class-giooutputstream">gio.OutputStream</link>
57 +-- <link linkend="class-giofilteroutputstream">gio.FilterOutputStream</link>
58 +-- <link linkend="class-giobufferedoutputstream">gio.BufferedOutputStream</link>
63 <refsect1 id="properties-giobufferedoutputstream">
64 <title>gio.BufferedOutputStream Properties</title>
66 <blockquote role="properties">
67 <informaltable pgwide="1" frame="none">
69 <colspec column="1" colwidth="1in"/>
70 <colspec column="2" colwidth="1in"/>
71 <colspec column="3" colwidth="4in"/>
74 <entry>"auto-grow"</entry>
75 <entry>Read - Write</entry>
76 <entry>Whether the buffer should automatically grow. Default value: <literal>False</literal>.</entry>
79 <entry>"buffer-size"</entry>
80 <entry>Read - Write - Construct</entry>
81 <entry>The size of the backend buffer. Allowed values: >= 1. Default value: 4096.</entry>
91 <title>Description</title>
94 <link linkend="class-giobufferedoutputstream"><classname>gio.BufferedOutputStream</classname></link>
95 implements <link linkend="class-giofilteroutputstream"><classname>gio.FilterOutputStream</classname></link>
96 and provides for buffered writes.
100 <link linkend="class-giobufferedoutputstream"><classname>gio.BufferedOutputStream</classname></link>'s
101 buffer size is set at 4 kilobytes.
104 To create a buffered output stream, use
105 <methodname><link linkend="constructor-giobufferedoutputstream">gio.BufferedOutputStream</link></methodname>(),
106 or <methodname><link linkend="function-gio--buffered-output-stream-new-sized">gio.buffered_output_stream_new_sized</link></methodname>()
107 to specify the buffer's size at construction.
110 To get the size of a buffer within a buffered output stream, use
111 <methodname><link linkend="method-giobufferedoutputstream--get-buffer-size">gio.BufferedOutputStream.get_buffer_size</link></methodname>().
112 To change the size of a buffered output stream's buffer, use
113 <methodname><link linkend="method-giobufferedoutputstream--set-buffer-size">gio.BufferedOutputStream.set_buffer_size</link></methodname>().
114 Note that the buffer's size cannot be reduced below the size of the data within the buffer.
118 <refsect1 id="constructor-giobufferedoutputstream">
119 <title>Constructor</title>
121 <programlisting><constructorsynopsis language="python">
122 <methodname>gio.BufferedOutputStream</methodname>
123 <methodparam><parameter role="keyword">base_stream</parameter></methodparam>
124 </constructorsynopsis></programlisting>
127 <term><parameter>base_stream</parameter> :</term>
129 <link linkend="class-giooutputstream"><classname>gio.OutputStream</classname></link>.
130 </simpara></listitem>
133 <term><emphasis>Returns</emphasis> :</term>
134 <listitem><simpara>a new
135 <link linkend="class-giooutputstream"><classname>gio.OutputStream</classname></link>
136 for the given base_stream.
137 </simpara></listitem>
142 Creates a new buffered output stream for a base stream.
148 <title>Methods</title>
150 <refsect2 id="method-giobufferedoutputstream--get-auto-grow">
151 <title>gio.BufferedOutputStream.get_auto_grow</title>
153 <programlisting><methodsynopsis language="python">
154 <methodname>get_auto_grow</methodname>
155 <methodparam></methodparam>
156 </methodsynopsis></programlisting>
160 <term><emphasis>Returns</emphasis> :</term>
161 <listitem><simpara><literal>True</literal> if the stream's
162 buffer automatically grows, <literal>False</literal> otherwise.
163 </simpara></listitem>
168 The <methodname>get_auto_grow</methodname>() method checks if the
169 buffer automatically grows as data is added.
173 <refsect2 id="method-giobufferedoutputstream--get-buffer-size">
174 <title>gio.BufferedOutputStream.get_buffer_size</title>
176 <programlisting><methodsynopsis language="python">
177 <methodname>get_buffer_size</methodname>
178 <methodparam></methodparam>
179 </methodsynopsis></programlisting>
183 <term><emphasis>Returns</emphasis> :</term>
184 <listitem><simpara>the current buffer size.
185 </simpara></listitem>
190 The <methodname>get_buffer_size</methodname>() method gets the size
191 of the buffer in the stream.
195 <refsect2 id="method-giobufferedoutputstream--set-auto-grow">
196 <title>gio.BufferedOutputStream.set_auto_grow</title>
198 <programlisting><methodsynopsis language="python">
199 <methodname>set_auto_grow</methodname>
200 <methodparam><parameter role="keyword">auto_grow</parameter></methodparam>
201 </methodsynopsis></programlisting>
205 <term><parameter role="keyword">auto_grow</parameter> :</term>
206 <listitem><simpara>a boolean.
207 </simpara></listitem>
212 The <methodname>set_auto_grow</methodname>() method sets whether or not
213 the stream's buffer should automatically grow. If auto_grow is true,
214 then each write will just make the buffer larger, and you must manually
215 flush the buffer to actually write out the data to the underlying stream.
219 <refsect2 id="method-giobufferedoutputstream--set-buffer-size">
220 <title>gio.BufferedOutputStream.set_buffer_size</title>
222 <programlisting><methodsynopsis language="python">
223 <methodname>set_buffer_size</methodname>
224 <methodparam><parameter role="keyword">size</parameter></methodparam>
225 </methodsynopsis></programlisting>
229 <term><parameter role="keyword">size</parameter> :</term>
230 <listitem><simpara>the new buffer size.
231 </simpara></listitem>
236 The <methodname>set_buffer_size</methodname>() method sets the size of
237 the internal buffer to size.
243 <title>Functions</title>
245 <refsect2 id="function-gio--buffered-output-stream-new-sized">
246 <title>gio.buffered_output_stream_new_sized</title>
248 <programlisting><methodsynopsis language="python">
249 <methodname>buffered_output_stream_new_sized</methodname>
250 <methodparam><parameter role="keyword">size</parameter></methodparam>
251 </methodsynopsis></programlisting>
255 <term><parameter>size</parameter> :</term>
256 <listitem><simpara>the requested buffer size.
257 </simpara></listitem>
260 <term><emphasis>Returns</emphasis> :</term>
261 <listitem><simpara>A new
262 <link linkend="class-giooutputstream"><classname>gio.OutputStream</classname></link>
263 with an internal buffer set to size..
264 </simpara></listitem>
269 The <methodname>buffered_output_stream_new_sized</methodname>() function creates
270 a new <link linkend="class-giobufferedoutputstream"><classname>gio.BufferedOutputStream</classname></link>
271 from the given base_stream, with a buffer set to size.