Death::IO::Stream class
#include <IO/Stream.h>

Provides a generic view of a sequence of bytes.

Base classes

class Death::IDisposable
Base interface for releasing resources on object destruction.

Derived classes

class AndroidAssetStream
Read-only streaming directly from Android asset files.
class BoundedFileStream
Provides only specified portion of the specified seekable input stream.
class DeflateStream
Provides read-only streaming of compressed data using the Deflate algorithm.
class DeflateWriter
Provides write-only streaming to compress written data by using the Deflate algorithm.
class Lz4Stream
Provides read-only streaming of compressed data using the LZ4 compression algorithm.
class Lz4Writer
Provides write-only streaming to compress written data by using the LZ4 compression algorithm.
class ZstdStream
Provides read-only streaming of compressed data using the Zstandard compression algorithm.
class ZstdWriter
Provides write-only streaming to compress written data by using the Zstandard compression algorithm.
class EmscriptenFileStream
Provides access to a file selected by the user in the browser.
class FileStream
Allows streaming from/to a file on a local filesystem.
class MemoryStream
Provides stream interface for a region of memory.

Public types

enum (anonymous) { Invalid = -1, OutOfRange = -2, NotSeekable = -3 }

Public static functions

static auto Uint16FromLE(std::uint16_t value) -> std::uint16_t noexcept
Converts a 16-bit value from little-endian to native.
static auto Uint32FromLE(std::uint32_t value) -> std::uint32_t noexcept
Converts a 32-bit value from little-endian to native.
static auto Uint64FromLE(std::uint64_t value) -> std::uint64_t noexcept
Converts a 64-bit value from little-endian to native.
static auto Uint16FromBE(std::uint16_t value) -> std::uint16_t noexcept
Converts a 16-bit value from big-endian to native.
static auto Uint32FromBE(std::uint32_t value) -> std::uint32_t noexcept
Converts a 32-bit value from big-endian to native.
static auto Uint64FromBE(std::uint64_t value) -> std::uint64_t noexcept
Converts a 64-bit value from big-endian to native.

Constructors, destructors, conversion operators

operator bool() explicit
Whether the stream has been sucessfully opened.

Public functions

void Dispose() pure virtual
Closes the stream and releases all assigned resources.
auto Seek(std::int64_t offset, SeekOrigin origin) -> std::int64_t pure virtual
Seeks in an opened stream.
auto GetPosition() const -> std::int64_t pure virtual
Tells the seek position of an opened stream.
auto Read(void* destination, std::int64_t bytesToRead) -> std::int64_t pure virtual
Reads a certain amount of bytes from the stream to a buffer.
auto Write(const void* source, std::int64_t bytesToWrite) -> std::int64_t pure virtual
Writes a certain amount of bytes from a buffer to the stream.
auto Flush() -> bool pure virtual
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
auto IsValid() -> bool pure virtual
Returns true if the stream has been sucessfully opened.
auto GetSize() const -> std::int64_t pure virtual
Returns stream size in bytes.
auto CopyTo(Stream& targetStream) -> std::int64_t
Reads the bytes from the current stream and writes them to the target stream.
template<typename T, class = typename std::enable_if<std::is_trivially_copyable<T>::value>::type>
auto ReadValue() -> T
Reads a trivial value from the stream.
template<typename T, class = typename std::enable_if<std::is_trivially_copyable<T>::value>::type>
void WriteValue(const T& value)
Writes a trivial value to the stream.
auto ReadVariableInt32() -> std::int32_t
Reads a 32-bit integer value from the stream using variable-length quantity encoding.
auto ReadVariableInt64() -> std::int64_t
Reads a 64-bit integer value from the stream using variable-length quantity encoding.
auto ReadVariableUint32() -> std::uint32_t
Reads a 32-bit unsigned integer value from the stream using variable-length quantity encoding.
auto ReadVariableUint64() -> std::uint64_t
Reads a 64-bit unsigned integer value from the stream using variable-length quantity encoding.
auto WriteVariableInt32(std::int32_t value) -> std::int64_t
Writes a 32-bit integer value to the stream using variable-length quantity encoding.
auto WriteVariableInt64(std::int64_t value) -> std::int64_t
Writes a 64-bit integer value to the stream using variable-length quantity encoding.
auto WriteVariableUint32(std::uint32_t value) -> std::int64_t
Writes a 32-bit unsigned integer value to the stream using variable-length quantity encoding.
auto WriteVariableUint64(std::uint64_t value) -> std::int64_t
Writes a 64-bit unsigned integer value to the stream using variable-length quantity encoding.

Enum documentation

enum Death::IO::Stream::(anonymous)

Enumerators
Invalid

Returned if Stream doesn't point to valid source.

OutOfRange

Returned if one of the parameters provided to a method is not valid.

NotSeekable

Returned if seek operation is not supported by Stream or the stream length is unknown.