ezEngine  Milestone 7
ezMemoryStreamReader Class Reference

A reader which can access a memory stream. More...

#include <MemoryStream.h>

Inheritance diagram for ezMemoryStreamReader:

Public Member Functions

 ezMemoryStreamReader (ezMemoryStreamStorage *pStreamStorage=nullptr)
 Pass the memory storage object from which to read from. Pass nullptr if you are going to set the storage stream later via SetStorage().
 
void SetStorage (ezMemoryStreamStorage *pStreamStorage)
 Sets the storage object upon which to operate. Resets the read position to zero. Pass nullptr if you want to detach from any previous storage stream, for example to ensure its reference count gets properly reduced.
 
virtual ezUInt64 ReadBytes (void *pReadBuffer, ezUInt64 uiBytesToRead) override
 Reads either uiBytesToRead or the amount of remaining bytes in the stream into pReadBuffer. More...
 
virtual ezUInt64 SkipBytes (ezUInt64 uiBytesToSkip) override
 Skips bytes in the stream (e.g. for skipping objects which can't be serialized due to missing information etc.)
 
void SetReadPosition (ezUInt32 uiReadPosition)
 Sets the read position to be used.
 
ezUInt32 GetByteCount () const
 Returns the total available bytes in the memory stream.
 
- Public Member Functions inherited from ezStreamReaderBase
 ezStreamReaderBase ()
 Constructor.
 
virtual ~ezStreamReaderBase ()
 Virtual destructor to ensure correct cleanup.
 
template<typename T >
ezResult ReadWordValue (T *pWordValue)
 Helper method to read a word value correctly (copes with potentially different endianess)
 
template<typename T >
ezResult ReadDWordValue (T *pDWordValue)
 Helper method to read a dword value correctly (copes with potentially different endianess)
 
template<typename T >
ezResult ReadQWordValue (T *pQWordValue)
 Helper method to read a qword value correctly (copes with potentially different endianess)
 

Private Attributes

ezScopedRefPointer
< ezMemoryStreamStorage
m_pStreamStorage
 
ezUInt32 m_uiReadPosition
 

Detailed Description

A reader which can access a memory stream.

Please note that the functions exposed by this object are not thread safe! If access to the same ezMemoryStreamStorage object from multiple threads is desired please create one instance of ezMemoryStreamReader per thread.

Member Function Documentation

ezUInt64 ezMemoryStreamReader::ReadBytes ( void *  pReadBuffer,
ezUInt64  uiBytesToRead 
)
overridevirtual

Reads either uiBytesToRead or the amount of remaining bytes in the stream into pReadBuffer.

It is valid to pass nullptr for pReadBuffer, in this case the memory stream position is only advanced by the given number of bytes.

Implements ezStreamReaderBase.


The documentation for this class was generated from the following files: