# Gio::MemoryOutputStream Class Reference
[Stream Classes]

Streaming output operations on memory chunks. More...

`#include <giomm/memoryoutputstream.h>`

Inheritance diagram for Gio::MemoryOutputStream:
[legend]

List of all members.

## Public Member Functions
virtual | ~MemoryOutputStream ()
GMemoryOutputStream* | gobj ()
| Provides access to the underlying C GObject.
const GMemoryOutputStream* | gobj () const
| Provides access to the underlying C GObject.
GMemoryOutputStream* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
gpointer | get_data ()
| Gets any loaded data from the ostream.
gsize | get_size () const
| Gets the size of the currently allocated data area (availible from g_memory_output_stream_get_data()).
gsize | get_data_size () const
| Returns: the number of bytes written to the stream.
## Static Public Member Functions
static Glib::RefPtr < MemoryOutputStream > | create (gpointer data, gsize len, GReallocFunc realloc_fn, GDestroyNotify destroy)
## Protected Member Functions
| MemoryOutputStream (gpointer data, gsize len, GReallocFunc realloc_fn, GDestroyNotify destroy)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < Gio::MemoryOutputStream > | wrap (GMemoryOutputStream* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Streaming output operations on memory chunks.

Since glibmm 2.20:

## Constructor & Destructor Documentation

virtual Gio::MemoryOutputStream::~MemoryOutputStream | ( |  | ) | `[virtual]`

Gio::MemoryOutputStream::MemoryOutputStream | ( | gpointer | data,
|  | gsize | len,
|  | GReallocFunc | realloc_fn,
|  | GDestroyNotify | destroy |
| ) |  |  | `[explicit, protected]`

## Member Function Documentation

static Glib::RefPtr<MemoryOutputStream> Gio::MemoryOutputStream::create | ( | gpointer | data,
|  | gsize | len,
|  | GReallocFunc | realloc_fn,
|  | GDestroyNotify | destroy |
| ) |  |  | `[static]`

gpointer Gio::MemoryOutputStream::get_data | ( |  | ) |

Gets any loaded data from the ostream.

Note that the returned pointer may become invalid on the next write or truncate operation on the stream.

Returns:
  Pointer to the stream's data.

gsize Gio::MemoryOutputStream::get_data_size | ( |  | ) | const

Returns: the number of bytes written to the stream.

Returns:
  The number of bytes written to the stream

Since glibmm 2.18:

gsize Gio::MemoryOutputStream::get_size | ( |  | ) | const

Gets the size of the currently allocated data area (availible from g_memory_output_stream_get_data()).

If the stream isn't growable (no realloc was passed to g_memory_output_stream_new()) then this is the maximum size of the stream and further writes will return IO_ERROR_NO_SPACE.

Note that for growable streams the returned size may become invalid on the next write or truncate operation on the stream.

If you want the number of bytes currently written to the stream, use g_memory_output_stream_get_data_size().

Returns:
  The number of bytes allocated for the data buffer.

const GMemoryOutputStream* Gio::MemoryOutputStream::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::OutputStream.

GMemoryOutputStream* Gio::MemoryOutputStream::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::OutputStream.

GMemoryOutputStream* Gio::MemoryOutputStream::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gio::OutputStream.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::MemoryOutputStream > wrap | ( | GMemoryOutputStream * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.