Class MemoryWriteStream
Direct memory writing stream that uses a single allocation buffer.
Assembly: FlaxEngine.dll
File: Engine/Serialization/MemoryWriteStream.h
Syntax
public class MemoryWriteStream : public WriteStream
Constructors
~MemoryWriteStream()
Destructor
Declaration
public ~MemoryWriteStream()
MemoryWriteStream()
MemoryWriteStream(uint32 capacity)
Initializes a new instance of the MemoryWriteStream class.
Declaration
public MemoryWriteStream(uint32 capacity)
Parameters
uint32
capacity
Initial write buffer capacity (in bytes). |
Methods
Close()
Flush()
GetCapacity()
Gets the current capacity of the stream.
Declaration
public uint32 GetCapacity() const
Returns
uint32
|
GetHandle()
Gets the pointer to the buffer in memory.
Declaration
public byte* GetHandle() const
Returns
byte
|
GetLength()
Gets current stream length (capacity in bytes).
Declaration
public uint32 GetLength() const
Returns
uint32
|
GetPosition()
Gets current position in the stream (in bytes).
Declaration
public uint32 GetPosition() const
Returns
uint32
|
Move()
Skips the data from the target buffer without writing to it. Moves the write 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 bytes from the target buffer without writing to it. Moves the write pointer in the buffer forward.
Declaration
public void* Move(uint32 bytes)
Parameters
uint32
bytes
The amount of bytes to skip. |
Returns
void
The pointer to the target bytes in memory. |
Reset(uint32 capacity)
Cleanups the buffers, resets the position and allocated the new memory chunk.
Declaration
public void Reset(uint32 capacity)
Parameters
uint32
capacity
Initial write buffer capacity (in bytes). |
SaveToFile(const StringView& path)
Saves current buffer contents to the file.
Declaration
public bool SaveToFile(const StringView& path) const
Parameters
StringView
path
The file path. |
Returns
bool
True if cannot save data, otherwise false. |
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 |
Overrides
WriteBytes(const void* data, uint32 bytes)
Writes bytes to the stream.
Declaration
public virtual void WriteBytes(const void* data, uint32 bytes) override
Parameters
void
data
Pointer to data to write. |
uint32
bytes
Amount of bytes to write. |