Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::MemoryStream Class Reference

Constructs a MemoryStream object by default. More...

Inheritance diagram for Nz::MemoryStream:
Nz::Stream

Public Member Functions

 MemoryStream (ByteArray *byteArray, OpenModeFlags openMode=OpenMode_ReadWrite)
 Constructs a MemoryStream object with a byte array. More...
 
 MemoryStream (const MemoryStream &)=default
 
 MemoryStream (MemoryStream &&)=default
 
void Clear ()
 Clears the content of the stream.
 
bool EndOfStream () const override
 Checks whether the stream reached the end of the stream. More...
 
ByteArrayGetBuffer ()
 Gets the internal buffer. More...
 
const ByteArrayGetBuffer () const
 Gets the internal buffer. More...
 
UInt64 GetCursorPos () const override
 Gets the position of the cursor. More...
 
UInt64 GetSize () const override
 Gets the size of the raw memory. More...
 
void SetBuffer (ByteArray *byteArray, OpenModeFlags openMode=OpenMode_ReadWrite)
 Sets the buffer for the memory stream. More...
 
bool SetCursorPos (UInt64 offset) override
 Sets the position of the cursor. More...
 
MemoryStreamoperator= (const MemoryStream &)=default
 
MemoryStreamoperator= (MemoryStream &&)=default
 
- Public Member Functions inherited from Nz::Stream
 Stream (const Stream &)=default
 
 Stream (Stream &&)=default
 
virtual ~Stream ()
 Destructs the object.
 
void EnableTextMode (bool textMode)
 Enables the text mode. More...
 
void Flush ()
 Flushes the stream. More...
 
virtual String GetDirectory () const
 Gets the directory of the stream. More...
 
virtual String GetPath () const
 Gets the path of the stream. More...
 
OpenModeFlags GetOpenMode () const
 Gets the open mode of the stream. More...
 
StreamOptionFlags GetStreamOptions () const
 Gets the options of the stream. More...
 
std::size_t Read (void *buffer, std::size_t size)
 Reads the stream and puts the result in a buffer. More...
 
virtual String ReadLine (unsigned int lineSize=0)
 Reads a line from the stream. More...
 
bool IsReadable () const
 Checks whether the stream is readable. More...
 
bool IsSequential () const
 Checks whether the stream is sequential. More...
 
bool IsTextModeEnabled () const
 Checks whether the stream has text mode enabled. More...
 
bool IsWritable () const
 Checks whether the stream can be written. More...
 
bool Write (const ByteArray &byteArray)
 Writes a ByteArray into the stream. More...
 
bool Write (const String &string)
 Writes a String into the stream. More...
 
std::size_t Write (const void *buffer, std::size_t size)
 Writes in the stream the content of a buffer. More...
 
Streamoperator= (const Stream &)=default
 
Streamoperator= (Stream &&)=default
 

Additional Inherited Members

- Protected Member Functions inherited from Nz::Stream
 Stream (StreamOptionFlags streamOptions=StreamOption_None, OpenModeFlags openMode=OpenMode_NotOpen)
 Constructs a Stream object with options. More...
 
- Protected Attributes inherited from Nz::Stream
OpenModeFlags m_openMode
 
StreamOptionFlags m_streamOptions
 

Detailed Description

Constructs a MemoryStream object by default.

Core class that represents a stream of memory.

Constructor & Destructor Documentation

◆ MemoryStream()

Nz::MemoryStream::MemoryStream ( ByteArray byteArray,
OpenModeFlags  openMode = OpenMode_ReadWrite 
)
inline

Constructs a MemoryStream object with a byte array.

Parameters
byteArrayBytes to stream
openModeReading/writing mode for the stream

Member Function Documentation

◆ EndOfStream()

bool Nz::MemoryStream::EndOfStream ( ) const
overridevirtual

Checks whether the stream reached the end of the stream.

Returns
true if cursor is at the end of the stream

Implements Nz::Stream.

◆ GetBuffer() [1/2]

ByteArray & Nz::MemoryStream::GetBuffer ( )
inline

Gets the internal buffer.

Returns
Buffer of bytes
Remarks
Produces a NazaraAssert if buffer is invalid

◆ GetBuffer() [2/2]

const ByteArray & Nz::MemoryStream::GetBuffer ( ) const
inline

Gets the internal buffer.

Returns
Buffer of bytes
Remarks
Produces a NazaraAssert if buffer is invalid

◆ GetCursorPos()

UInt64 Nz::MemoryStream::GetCursorPos ( ) const
overridevirtual

Gets the position of the cursor.

Returns
Position of the cursor

Implements Nz::Stream.

◆ GetSize()

UInt64 Nz::MemoryStream::GetSize ( ) const
overridevirtual

Gets the size of the raw memory.

Returns
Size of the memory

Implements Nz::Stream.

◆ SetBuffer()

void Nz::MemoryStream::SetBuffer ( ByteArray byteArray,
OpenModeFlags  openMode = OpenMode_ReadWrite 
)

Sets the buffer for the memory stream.

Parameters
byteArrayBytes to stream
openModeReading/writing mode for the stream
Remarks
Produces a NazaraAssert if byteArray is nullptr

◆ SetCursorPos()

bool Nz::MemoryStream::SetCursorPos ( UInt64  offset)
overridevirtual

Sets the position of the cursor.

Returns
true
Parameters
offsetOffset according to the beginning of the stream

Implements Nz::Stream.


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