![]() |
Murl Engine API
Version 2018.3
|
The memory stream class. More...
#include <murl_util_memory_stream.h>
The memory stream class.
The MemoryStream class implements file behaviour on a memory block. The memory to read from is used by reference only, which allows using memory mapped files without copying the data to memory.
(!) The ownership of the data object's memory pointer remains to the caller. This means as long as the MemoryStream is used, the memory pointer of the data object (but probably not to data object itself) must be available in memory.
Public Member Functions | |
MemoryStream () | |
The default constructor. | |
virtual | ~MemoryStream () |
The destructor. | |
virtual Bool | Open (const ConstData &data) |
Open a memory stream from a data object. More... | |
virtual Bool | Open (const void *data, UInt64 byteSize) |
Open a memory stream. More... | |
virtual Bool | Close () |
Close the memory stream. More... | |
Bool | IsOpen () const |
Check if the memory stream is open. More... | |
virtual UInt64 | GetSize () const |
Get the size of the memory stream. More... | |
virtual UInt64 | GetPosition () const |
Get the current read position. More... | |
virtual void | SetPosition (UInt64 position) |
Set the current read position. More... | |
virtual UInt64 | Read (void *data, UInt64 byteSize) |
Read from the memory stream at the current position. More... | |
virtual Bool | Eos () const |
Check if the end of the stream is reached. More... | |
Protected Attributes | |
ConstData | mData |
Reference to the memory data. More... | |
Bool | mIsOpen |
The open status. More... | |
UInt64 | mCurrentOffset |
The current byte position. More... | |
Open a memory stream from a data object.
data | The data object. |
Open a memory stream.
data | Pointer to the memory location. |
byteSize | Byte size of the memory location. |
|
virtual |
Close the memory stream.
Bool Murl::Util::MemoryStream::IsOpen | ( | ) | const |
Check if the memory stream is open.
|
virtual |
Get the size of the memory stream.
|
virtual |
Get the current read position.
|
virtual |
Set the current read position.
position | The current read in bytes. |
Read from the memory stream at the current position.
data | Pointer to the memory to read into. |
byteSize | The byte size of the memory. |
|
virtual |
Check if the end of the stream is reached.
|
protected |
Reference to the memory data.
|
protected |
The open status.
|
protected |
The current byte position.