glibmm 2.30.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# 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.
const void* | get_data () const
| Gets any loaded data from the ostream.
void* | steal_data ()
| Gets any loaded data from the ostream.
gsize | get_size () const
| Gets the size of the currently allocated data area (available from g_memory_output_stream_get_data()).
gsize | get_data_size () const
| Returns the number of bytes from the start up to including the last byte written in the stream that has not been truncated away.
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.

This class uses arbitrary memory chunks as output for GIO streaming output operations.

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.

const void* Gio::MemoryOutputStream::get_data | ( |  | ) | const

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 from the start up to including the last byte written in the stream that has not been truncated away.

Since glibmm 2.18:

Returns:
  The number of bytes written to the stream.

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

Gets the size of the currently allocated data area (available 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.

void* Gio::MemoryOutputStream::steal_data | ( |  | ) |

Gets any loaded data from the ostream.

Ownership of the data is transferred to the caller; when no longer needed it must be freed using the free function set in ostream's MemoryOutputStream:destroy-function property.

ostream must be closed before calling this function.

Since glibmm 2.26:

Returns:
  The stream's data.

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