# 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.
void* | 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.
Glib::PropertyProxy_ReadOnly < void* > | property_data () const
| Pointer to buffer where data will be written.
Glib::PropertyProxy_ReadOnly < gulong > | property_data_size () const
| Size of data written to the buffer.
Glib::PropertyProxy_ReadOnly < gulong > | property_size () const
| Current size of the data buffer.

## Static Public Member Functions

static Glib::RefPtr < MemoryOutputStream > | create (void* data, gsize size, GReallocFunc realloc_function, GDestroyNotify destroy_function)

## Protected Member Functions

| MemoryOutputStream (void* data, gsize size, GReallocFunc realloc_function, GDestroyNotify destroy_function)

## 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 | ( | void * | data,
|  | gsize | size,
|  | GReallocFunc | realloc_function,
|  | GDestroyNotify | destroy_function |
| ) |  |  | `[explicit, protected]`

## Member Function Documentation

static Glib::RefPtr<MemoryOutputStream> Gio::MemoryOutputStream::create | ( | void * | data,
|  | gsize | size,
|  | GReallocFunc | realloc_function,
|  | GDestroyNotify | destroy_function |
| ) |  |  | `[static]`

void* 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.

Glib::PropertyProxy_ReadOnly<void*> Gio::MemoryOutputStream::property_data | ( |  | ) | const

Pointer to buffer where data will be written.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<gulong> Gio::MemoryOutputStream::property_data_size | ( |  | ) | const

Size of data written to the buffer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<gulong> Gio::MemoryOutputStream::property_size | ( |  | ) | const

Current size of the data buffer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

## 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.