# wxMemoryInputStream Class Reference
[Streams]

`#include <wx/mstream.h>`

Inheritance diagram for wxMemoryInputStream:
[legend]

## Detailed Description

This class allows to use all methods taking a wxInputStream reference to read in-memory data.

Example:

            // we've got a block of memory containing a BMP image and we want
            // to use wxImage to load it:
            wxMemoryInputStream stream(my_memory_block, size);

            wxImage theBitmap;
            if (!theBitmap.LoadFile(stream, wxBITMAP_TYPE_BMP))
                return;

            // we can now safely delete the original memory buffer as the data
            // has been decoded by wxImage:
            delete [] my_memory_block;

##

Library: wxBase

Category: Streams

See also:
  wxStreamBuffer, wxMemoryOutputStream

## Public Member Functions
| wxMemoryInputStream (const void *data, size_t len)
| Initializes a new read-only memory stream which will use the specified buffer data of length len.
| wxMemoryInputStream (const wxMemoryOutputStream &stream)
| Creates a new read-only memory stream, initializing it with the data from the given output stream stream.
| wxMemoryInputStream (wxInputStream &stream, wxFileOffset len=wxInvalidOffset)
| Creates a new read-only memory stream, initializing it with the data from the given input stream stream.
virtual | ~wxMemoryInputStream ()
| Destructor.
wxStreamBuffer * | GetInputStreamBuffer () const
| Returns the pointer to the stream object used as an internal buffer for that stream.

List of all members.

## Constructor & Destructor Documentation

wxMemoryInputStream::wxMemoryInputStream | ( | const void * | data,
|  | size_t | len |
| ) |  |  |

Initializes a new read-only memory stream which will use the specified buffer data of length len.

The stream does not take ownership of the buffer, i.e. the buffer will not be deleted in its destructor.

wxMemoryInputStream::wxMemoryInputStream | ( | const wxMemoryOutputStream & | stream | ) |

Creates a new read-only memory stream, initializing it with the data from the given output stream stream.

wxMemoryInputStream::wxMemoryInputStream | ( | wxInputStream & | stream,
|  | wxFileOffset | len = `wxInvalidOffset` |
| ) |  |  |

Creates a new read-only memory stream, initializing it with the data from the given input stream stream.

The len argument specifies the amount of data to read from the stream. Setting it to wxInvalidOffset means that the stream is to be read entirely (i.e. till the EOF is reached).

virtual wxMemoryInputStream::~wxMemoryInputStream | ( |  | ) | `[virtual]`

Destructor.

Does NOT free the buffer provided in the ctor.

## Member Function Documentation

wxStreamBuffer* wxMemoryInputStream::GetInputStreamBuffer | ( |  | ) | const

Returns the pointer to the stream object used as an internal buffer for that stream.

|  | [ top ]