Death::IO::MemoryStream class

Provides stream interface for a region of memory.

Base classes

class Stream
Provides a generic view of a sequence of bytes.

Constructors, destructors, conversion operators

MemoryStream(std::int64_t initialCapacity = 0) explicit
MemoryStream(void* bufferPtr, std::int64_t bufferSize)
MemoryStream(const void* bufferPtr, std::int64_t bufferSize)
MemoryStream(Containers::ArrayView<const char> buffer)
MemoryStream(Containers::ArrayView<const std::uint8_t> buffer)
MemoryStream(const MemoryStream&) deleted

Public functions

auto operator=(const MemoryStream&) -> MemoryStream& deleted
void Dispose() override
Closes the stream and releases all assigned resources.
auto Seek(std::int64_t offset, SeekOrigin origin) -> std::int64_t override
Seeks in an opened stream.
auto GetPosition() const -> std::int64_t override
Tells the seek position of an opened stream.
auto Read(void* destination, std::int64_t bytesToRead) -> std::int64_t override
Reads a certain amount of bytes from the stream to a buffer.
auto Write(const void* source, std::int64_t bytesToWrite) -> std::int64_t override
Writes a certain amount of bytes from a buffer to the stream.
auto Flush() -> bool override
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
auto IsValid() -> bool override
Returns true if the stream has been sucessfully opened.
auto GetSize() const -> std::int64_t override
Returns stream size in bytes.
void ReserveCapacity(std::int64_t bytes)
Reserves a capacity in growable memory stream.
auto FetchFromStream(Stream& source, std::int64_t bytesToRead) -> std::int64_t
Copies a specified number of bytes from a source stream to the current position.
auto GetBuffer() -> std::uint8_t*
Returns a pointer to underlying buffer.
auto GetBuffer() const -> const std::uint8_t*
auto GetCurrentPointer(std::int64_t bytes) -> const std::uint8_t*
Returns a pointer to the current position, which is then incremented by a given number of bytes.

Function documentation

const std::uint8_t* Death::IO::MemoryStream::GetBuffer() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.