The memory stream class. More...
#include "murl_util_memory_stream.h"
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. | |
Bool | mIsOpen |
The open status. | |
UInt64 | mCurrentOffset |
The current byte position. | |
Detailed Description
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.
Member Function Documentation
◆ Open() [1/2]
Open a memory stream from a data object.
- Parameters
-
data The data object.
- Returns
- true if successful.
◆ Open() [2/2]
Open a memory stream.
- Parameters
-
data Pointer to the memory location. byteSize Byte size of the memory location.
- Returns
- true if successful.
◆ Close()
|
virtual |
Close the memory stream.
- Returns
- true if successful.
◆ IsOpen()
Bool Murl::Util::MemoryStream::IsOpen | ( | ) | const |
Check if the memory stream is open.
- Returns
- true if the memory stream is open.
◆ GetSize()
|
virtual |
Get the size of the memory stream.
- Returns
- The byte size of the memory stream.
◆ GetPosition()
|
virtual |
Get the current read position.
- Returns
- The current read position in bytes.
◆ SetPosition()
|
virtual |
Set the current read position.
- Parameters
-
position The current read in bytes.
◆ Read()
Read from the memory stream at the current position.
- Parameters
-
data Pointer to the memory to read into. byteSize The byte size of the memory.
- Returns
- The number of bytes read from the memory stream.
◆ Eos()
|
virtual |
Check if the end of the stream is reached.
- Returns
- true if the end of the stream is reached.
The documentation for this class was generated from the following file:
- murl_util_memory_stream.h