IRandomAccess interface
public interface IRandomAccess : IDisposable A read-only file read at any offset, without a position to seek. TryOpenAccess returns one, as does the OpenAccess extension, which throws FileNotFoundException where the Try form returns false. Archive readers keep one per archive and read it from many threads at once. The caller disposes it.
using var access = parent.OpenAccess(path);
var header = new byte[96];
access.ReadExactly(0, header);
The engine has HostFile for a file on disk, MemoryAccess for bytes in memory, SliceAccess for a range or several ranges of another access, and StreamAccess, which wraps a seekable stream behind a lock and is what TryOpenAccess’s default returns. AccessStream turns an access back into a Stream. The ReadExactly extension fills the whole buffer or throws EndOfStreamException when the file ends first.
- Assembly
- EvilEngine.Mounts
- Commit
- 4ff877b1