Class MemoryReadStream
Direct memory reading stream that uses a single allocation buffer.
Assembly: FlaxEngine.dll
File: Engine/Serialization/MemoryReadStream.h
Syntax
public class MemoryReadStream : public ReadStream
Constructors
MemoryReadStream()
Init (empty, cannot access before Init())
Initializes a new instance of the MemoryReadStream class.
Declaration
public MemoryReadStream()
MemoryReadStream(const Array<T, AllocationType>& data)
Initializes a new instance of the MemoryReadStream class.
Declaration
public MemoryReadStream(const Array<T, AllocationType>& data)
Parameters
Array<T, AllocationType>
data
Array with data to read from. |
Type Parameters
typename T
|
typename AllocationType
|
MemoryReadStream(const byte* bytes, uint32 length)
Initializes a new instance of the MemoryReadStream class.
Declaration
public MemoryReadStream(const byte* bytes, uint32 length)
Parameters
byte
bytes
Bytes with data to read from it (no memory cloned, using input buffer). |
uint32
length
Amount of bytes |
MemoryReadStream(const Span<T>& data)
Initializes a new instance of the MemoryReadStream class.
Declaration
public MemoryReadStream(const Span<T>& data)
Parameters
Span<T>
data
Span with data to read from. |
Type Parameters
typename T
|
Methods
Close()
Flush()
GetLength()
Gets length of the stream
Declaration
public virtual uint32 GetLength() override
Returns
uint32
Length of the stream |
Overrides
GetPosition()
Gets current position in the stream
Declaration
public virtual uint32 GetPosition() override
Returns
uint32
Current position in the stream |
Overrides
GetPositionHandle()
Gets the current handle to position in buffer.
Declaration
public byte* GetPositionHandle() const
Returns
byte
|
Init(const Array<T, AllocationType>& data)
Init stream to the custom buffer location.
Declaration
public void Init(const Array<T, AllocationType>& data)
Parameters
Array<T, AllocationType>
data
Array with data to read from. |
Returns
void
|
Type Parameters
typename T
|
typename AllocationType
|
Init(const byte* bytes, uint32 length)
Init stream to the custom buffer location.
Declaration
public void Init(const byte* bytes, uint32 length)
Parameters
byte
bytes
Bytes with data to read from it (no memory cloned, using input buffer). |
uint32
length
Amount of bytes. |
Move()
Skips the data from the target buffer without reading from it. Moves the read pointer in the buffer forward.
Declaration
public T* Move()
Returns
T
The pointer to the data in memory. |
Type Parameters
typename T
|
Move(uint32 bytes)
Skips the data from the target buffer without reading from it. Moves the read pointer in the buffer forward.
Declaration
public void* Move(uint32 bytes)
Parameters
uint32
bytes
The amount of bytes to read. |
Returns
void
The pointer to the data in memory. |
ReadBytes(void* data, uint32 bytes)
Reads bytes from the stream
Declaration
public virtual void ReadBytes(void* data, uint32 bytes) override
Parameters
void
data
Data to read |
uint32
bytes
Amount of bytes to read |
Overrides
SetPosition(uint32 seek)
Set new position in the stream
Declaration
public virtual void SetPosition(uint32 seek) override
Parameters
uint32
seek
New position in the stream |