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-giomemoryoutputstream">
7 <refname>gio.MemoryOutputStream</refname>
8 <refpurpose>Streaming output operations on memory chunks</refpurpose>
12 <title>Synopsis</title>
14 <classsynopsis language="python">
15 <ooclass><classname>gio.MemoryOutputStream</classname></ooclass>
16 <ooclass><classname><link linkend="class-giooutputstream">gio.OutputStream</link></classname></ooclass>
18 <constructorsynopsis language="python">
19 <methodname><link linkend="constructor-giomemoryoutputstream">gio.MemoryOutputStream</link></methodname>
20 <methodparam></methodparam>
21 </constructorsynopsis>
24 <methodsynopsis language="python">
25 <methodname><link linkend="method-giomemoryoutputstream--get-contents">get_contents</link></methodname>
26 <methodparam></methodparam>
28 <methodsynopsis language="python">
29 <methodname><link linkend="method-giomemoryoutputstream--get-data-size">get_data_size</link></methodname>
30 <methodparam></methodparam>
32 <methodsynopsis language="python">
33 <methodname><link linkend="method-giomemoryoutputstream--get-size">get_size</link></methodname>
34 <methodparam></methodparam>
42 <title>Ancestry</title>
44 <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
45 +-- <link linkend="class-giooutputstream">gio.OutputStream</link>
46 +-- <link linkend="class-giomemoryoutputstream">gio.MemoryOutputStream</link>
52 <title>Implemented Interfaces</title>
54 <link linkend="class-giomemoryoutputstream"><classname>gio.MemoryOutputStream</classname></link>
56 <link linkend="class-gioseekable"><classname>gio.Seekable</classname></link>
61 <title>Description</title>
64 <link linkend="class-giomemoryoutputstream"><classname>gio.MemoryOutputStream</classname></link>
65 is a class for using arbitrary memory chunks as output for GIO streaming output operations.
69 <refsect1 id="constructor-giomemoryoutputstream">
70 <title>Constructor</title>
72 <programlisting><constructorsynopsis language="python">
73 <methodname>gio.MemoryOutputStream</methodname>
74 <methodparam></methodparam>
75 </constructorsynopsis></programlisting>
78 <term><emphasis>Returns</emphasis> :</term>
79 <listitem><simpara>a new
80 <link linkend="class-giomemoryoutputstream"><classname>gio.MemoryOutputStream</classname></link>.
87 <link linkend="class-giomemoryoutputstream"><classname>gio.MemoryOutputStream</classname></link>.
93 <title>Methods</title>
95 <refsect2 id="method-giomemoryoutputstream--get-contents">
96 <title>gio.MemoryOutputStream.get_contents</title>
98 <programlisting><methodsynopsis language="python">
99 <methodname>get_contents</methodname>
100 <methodparam></methodparam>
101 </methodsynopsis></programlisting>
105 <term><emphasis>Returns</emphasis> :</term>
106 <listitem><simpara>the stream's data
107 </simpara></listitem>
112 The <methodname>get_contents</methodname>() method gets any loaded data
116 Note that the returned data may become invalid on the next write or truncate
117 operation on the stream.
121 <refsect2 id="method-giomemoryoutputstream--get-data-size">
122 <title>gio.MemoryOutputStream.get_data_size</title>
124 <programlisting><methodsynopsis language="python">
125 <methodname>get_data_size</methodname>
126 <methodparam></methodparam>
127 </methodsynopsis></programlisting>
131 <term><emphasis>Returns</emphasis> :</term>
132 <listitem><simpara>the number of bytes written to the stream
133 </simpara></listitem>
138 The <methodname>get_data_size</methodname>() method returns the number
139 of bytes from the start up to including the last byte written in the
140 stream that has not been truncated away.
144 <refsect2 id="method-giomemoryoutputstream--get-size">
145 <title>gio.MemoryOutputStream.get_size</title>
147 <programlisting><methodsynopsis language="python">
148 <methodname>get_size</methodname>
149 <methodparam></methodparam>
150 </methodsynopsis></programlisting>
154 <term><emphasis>Returns</emphasis> :</term>
155 <listitem><simpara>the number of bytes allocated for the data buffer
156 </simpara></listitem>
161 The <methodname>get_size</methodname>() method gets the size of the
162 currently allocated data area (availible from
163 <methodname><link linkend="method-giomemoryoutputstream--get-contents">gio.MemoryOutputStream.get_contents</link></methodname>()
167 Note that for growable streams the returned size may become invalid on the next write or truncate operation on the stream.
170 If you want the number of bytes currently written to the stream, use
171 <methodname><link linkend="method-giomemoryoutputstream--get-data-size">gio.MemoryOutputStream.get_data_size</link></methodname>().