# Gio::MemoryInputStream Class Reference
Stream Classes

MemoryInputStream implements InputStream for arbitrary memory chunks. More...

`#include <giomm/memoryinputstream.h>`

Inheritance diagram for Gio::MemoryInputStream:
[legend]

List of all members.

## Public Member Functions

virtual | ~MemoryInputStream ()
GMemoryInputStream* | gobj ()
| Provides access to the underlying C GObject.
const GMemoryInputStream* | gobj () const
| Provides access to the underlying C GObject.
GMemoryInputStream* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | add_data (const std::string& data)
| Appends to data that can be read from the input stream.
void | add_data (const void* data, gssize len)
| Appends to data that can be read from the input stream.
void | add_data (const void* data, gssize len, GDestroyNotify destroy)
| Appends to data that can be read from the input stream.

## Static Public Member Functions

static Glib::RefPtr < MemoryInputStream > | create ()

## Protected Member Functions

| MemoryInputStream ()

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr < Gio::MemoryInputStream > | wrap (GMemoryInputStream* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

MemoryInputStream implements InputStream for arbitrary memory chunks.

Since glibmm 2.16:

## Constructor & Destructor Documentation

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

Gio::MemoryInputStream::MemoryInputStream | ( |  | ) | `[protected]`

## Member Function Documentation

void Gio::MemoryInputStream::add_data | ( | const std::string & | data | ) |

Appends to data that can be read from the input stream.

Parameters:

  data | Input data.

void Gio::MemoryInputStream::add_data | ( | const void * | data,
|  | gssize | len,
|  | GDestroyNotify | destroy
| ) |  |

Appends to data that can be read from the input stream.

Parameters:

  data | Input data.
  len | Length of the data, may be -1 if data is a null-terminated string.
  destroy | A function to be called to free the data when it is no longer needed

void Gio::MemoryInputStream::add_data | ( | const void * | data,
|  | gssize | len
| ) |  |

Appends to data that can be read from the input stream.

Note that the data will copied internally and freed when no longer needed.

Parameters:

  data | Input data.
  len | Length of the data, may be -1 if data is a null-terminated string.

Deprecated:
  Use version with destroy notification

static Glib::RefPtr<MemoryInputStream> Gio::MemoryInputStream::create | ( |  | ) | `[static]`

const GMemoryInputStream* Gio::MemoryInputStream::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::InputStream.

GMemoryInputStream* Gio::MemoryInputStream::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::InputStream.

GMemoryInputStream* Gio::MemoryInputStream::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::InputStream.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::MemoryInputStream > wrap | ( | GMemoryInputStream * | 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.