| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/gtk-doc/html/gio/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GMemoryOutputStream</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="streaming.html" title="Streaming I/O">
<link rel="prev" href="GMemoryInputStream.html" title="GMemoryInputStream">
<link rel="next" href="GBufferedInputStream.html" title="GBufferedInputStream">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
<link rel="chapter" href="ch01.html" title="Introduction">
<link rel="chapter" href="ch02.html" title="Compiling GIO applications">
<link rel="chapter" href="ch03.html" title="Running GIO applications">
<link rel="chapter" href="extending-gio.html" title="Extending GIO">
<link rel="part" href="pt02.html" title="Part II. API Reference">
<link rel="chapter" href="file_ops.html" title="File Operations">
<link rel="chapter" href="file_mon.html" title="File System Monitoring">
<link rel="chapter" href="async.html" title="Asynchronous I/O">
<link rel="chapter" href="streaming.html" title="Streaming I/O">
<link rel="chapter" href="types.html" title="File types and applications">
<link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
<link rel="chapter" href="icons.html" title="Icons">
<link rel="chapter" href="failable_initialization.html" title="Failable Initialization">
<link rel="chapter" href="networking.html" title="Lowlevel platform-independent network support">
<link rel="chapter" href="resolver.html" title="DNS resolution">
<link rel="chapter" href="highlevel-socket.html" title="Highlevel network functionallity">
<link rel="chapter" href="utils.html" title="Utilities">
<link rel="chapter" href="extending.html" title="Extending GIO">
<link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
<link rel="chapter" href="ch18.html" title="Migrating from POSIX to GIO">
<link rel="chapter" href="ch19.html" title="Migrating from GnomeVFS to GIO">
<link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.18">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.20">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.22">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GMemoryInputStream.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="streaming.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="GBufferedInputStream.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GMemoryOutputStream.synopsis" class="shortcut">Top</a>
|
<a href="#GMemoryOutputStream.description" class="shortcut">Description</a>
|
<a href="#GMemoryOutputStream.object-hierarchy" class="shortcut">Object Hierarchy</a>
|
<a href="#GMemoryOutputStream.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
</td></tr>
</table>
<div class="refentry" title="GMemoryOutputStream">
<a name="GMemoryOutputStream"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GMemoryOutputStream.top_of_page"></a>GMemoryOutputStream</span></h2>
<p>GMemoryOutputStream — Streaming output operations on memory chunks</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="GMemoryOutputStream.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <gio/gio.h>
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> (<a class="link" href="GMemoryOutputStream.html#GReallocFunc" title="GReallocFunc ()">*GReallocFunc</a>) (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> size);
<a class="link" href="GMemoryOutputStream.html#GMemoryOutputStream-struct" title="GMemoryOutputStream">GMemoryOutputStream</a>;
<a class="link" href="GOutputStream.html" title="GOutputStream">GOutputStream</a> * <a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-new" title="g_memory_output_stream_new ()">g_memory_output_stream_new</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> len,
<a class="link" href="GMemoryOutputStream.html#GReallocFunc" title="GReallocFunc ()">GReallocFunc</a> realloc_fn,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> destroy);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> <a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-get-data" title="g_memory_output_stream_get_data ()">g_memory_output_stream_get_data</a> (<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> *ostream);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> <a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-get-size" title="g_memory_output_stream_get_size ()">g_memory_output_stream_get_size</a> (<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> *ostream);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> <a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-get-data-size" title="g_memory_output_stream_get_data_size ()">g_memory_output_stream_get_data_size</a>
(<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> *ostream);
</pre>
</div>
<div class="refsect1" title="Object Hierarchy">
<a name="GMemoryOutputStream.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
<a
href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
+----<a class="link" href="GOutputStream.html" title="GOutputStream">GOutputStream</a>
+----GMemoryOutputStream
</pre>
</div>
<div class="refsect1" title="Implemented Interfaces">
<a name="GMemoryOutputStream.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GMemoryOutputStream implements
<a class="link" href="GSeekable.html" title="GSeekable">GSeekable</a>.</p>
</div>
<div class="refsect1" title="Description">
<a name="GMemoryOutputStream.description"></a><h2>Description</h2>
<p>
<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream"><span class="type">GMemoryOutputStream</span></a> is a class for using arbitrary
memory chunks as output for GIO streaming output operations.</p>
<p>
</p>
</div>
<div class="refsect1" title="Details">
<a name="GMemoryOutputStream.details"></a><h2>Details</h2>
<div class="refsect2" title="GReallocFunc ()">
<a name="GReallocFunc"></a><h3>GReallocFunc ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> (*GReallocFunc) (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> size);</pre>
<p>
Changes the size of the memory block pointed to by <em class="parameter"><code>data</code></em> to
<em class="parameter"><code>size</code></em> bytes.
</p>
<p>
The function should have the same semantics as <code class="function">realloc()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td> memory block to reallocate
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td> size to reallocate <em class="parameter"><code>data</code></em> to
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a pointer to the reallocated memory
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="GMemoryOutputStream">
<a name="GMemoryOutputStream-struct"></a><h3>GMemoryOutputStream</h3>
<pre class="programlisting">typedef struct _GMemoryOutputStream GMemoryOutputStream;</pre>
<p>
Implements <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> for arbitrary memory chunks.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" title="g_memory_output_stream_new ()">
<a name="g-memory-output-stream-new"></a><h3>g_memory_output_stream_new ()</h3>
<pre class="programlisting"><a class="link" href="GOutputStream.html" title="GOutputStream">GOutputStream</a> * g_memory_output_stream_new (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> len,
<a class="link" href="GMemoryOutputStream.html#GReallocFunc" title="GReallocFunc ()">GReallocFunc</a> realloc_fn,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> destroy);</pre>
<p>
Creates a new <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream"><span class="type">GMemoryOutputStream</span></a>.
</p>
<p>
If <em class="parameter"><code>data</code></em> is non-<a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>, the stream will use that for its internal storage.
If <em class="parameter"><code>realloc_fn</code></em> is non-<a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>, it will be used for resizing the internal
storage when necessary. To construct a fixed-size output stream,
pass <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> as <em class="parameter"><code>realloc_fn</code></em>.
</p>
<div class="informalexample"><pre class="programlisting">
/* a stream that can grow */
stream = g_memory_output_stream_new (NULL, 0, realloc, free);
/* a fixed-size stream */
data = malloc (200);
stream2 = g_memory_output_stream_new (data, 200, NULL, free);
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td> pointer to a chunk of memory to use, or <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
<td> the size of <em class="parameter"><code>data</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>realloc_fn</code></em> :</span></p></td>
<td> a function with <code class="function">realloc()</code> semantics to be called when
<em class="parameter"><code>data</code></em> needs to be grown, or <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td>
<td> a function to be called on <em class="parameter"><code>data</code></em> when the stream is finalized,
or <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A newly created <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream"><span class="type">GMemoryOutputStream</span></a> object.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_memory_output_stream_get_data ()">
<a name="g-memory-output-stream-get-data"></a><h3>g_memory_output_stream_get_data ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> g_memory_output_stream_get_data (<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> *ostream);</pre>
<p>
Gets any loaded data from the <em class="parameter"><code>ostream</code></em>.
</p>
<p>
Note that the returned pointer may become invalid on the next
write or truncate operation on the stream.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>ostream</code></em> :</span></p></td>
<td> a <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream"><span class="type">GMemoryOutputStream</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> pointer to the stream's data
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_memory_output_stream_get_size ()">
<a name="g-memory-output-stream-get-size"></a><h3>g_memory_output_stream_get_size ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> g_memory_output_stream_get_size (<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> *ostream);</pre>
<p>
Gets the size of the currently allocated data area (availible from
<a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-get-data" title="g_memory_output_stream_get_data ()"><code class="function">g_memory_output_stream_get_data()</code></a>). If the stream isn't
growable (no realloc was passed to <a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-new" title="g_memory_output_stream_new ()"><code class="function">g_memory_output_stream_new()</code></a>) then
this is the maximum size of the stream and further writes
will return <a class="link" href="gio-GIOError.html#G-IO-ERROR-NO-SPACE--CAPS"><code class="literal">G_IO_ERROR_NO_SPACE</code></a>.
</p>
<p>
Note that for growable streams the returned size may become invalid on
the next write or truncate operation on the stream.
</p>
<p>
If you want the number of bytes currently written to the stream, use
<a class="link" href="GMemoryOutputStream.html#g-memory-output-stream-get-data-size" title="g_memory_output_stream_get_data_size ()"><code class="function">g_memory_output_stream_get_data_size()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>ostream</code></em> :</span></p></td>
<td> a <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream"><span class="type">GMemoryOutputStream</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the number of bytes allocated for the data buffer
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_memory_output_stream_get_data_size ()">
<a name="g-memory-output-stream-get-data-size"></a><h3>g_memory_output_stream_get_data_size ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"
>gsize</a> g_memory_output_stream_get_data_size
(<a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream">GMemoryOutputStream</a> *ostream);</pre>
<p>
Returns the number of bytes from the start up
to including the last byte written in the stream
that has not been truncated away.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>ostream</code></em> :</span></p></td>
<td> a <a class="link" href="GMemoryOutputStream.html" title="GMemoryOutputStream"><span class="type">GMemoryOutputStream</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the number of bytes written to the stream
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.18</p>
</div>
</div>
<div class="refsect1" title="See Also">
<a name="GMemoryOutputStream.see-also"></a><h2>See Also</h2>
#GMemoryInputStream
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>