MemoryDeviceFile

Detailed Description

class MemoryDeviceFile

The MemoryDevice class is an in-memory virtual file used for sandboxing file IO. These objects can be obtained from a MemoryDevice object by calling MemoryDevice::OpenFileForReading.

Public Functions

MemoryDeviceFile()

Creates an invalid memory device file.

~MemoryDeviceFile()
MemoryDeviceFile(MemoryDeviceFile &&source) = default

Move construction. The source file will become invalid.

MemoryDeviceFile &operator=(MemoryDeviceFile &&source) = default

Move assignment. The source file will become invalid.

inline bool IsValid() const

Determines if this is a valid file object.

Returns:true if the file is valid, or false if it not. A moved-from file object will be invalid.
size_t Size() const

Query the size of the file.

Returns:The size, in bytes, of the given file.
size_t Read(uint8_t *buffer, size_t num_bytes)

Read bytes from the file

Returns:The number of bytes read.
void SeekToBeginning()

Resets the file such that the next Read operation will start at the beginning.