Class MappedAccessorVariable<T>
A memory mapped accessor that stores objects of a variable size in bytes.
Inherited Members
Namespace: Mars.Common.IO.Mapped.Accessors
Assembly: Mars.IO.dll
Syntax
public sealed class MappedAccessorVariable<T> : MappedAccessor<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
MappedAccessorVariable(MemoryMap, Stream, MemoryMap.ReadFromDelegate<T>, MemoryMap.WriteToDelegate<T>)
Creates a new memory mapped file.
Declaration
public MappedAccessorVariable(MemoryMap file, Stream stream, MemoryMap.ReadFromDelegate<T> readFrom, MemoryMap.WriteToDelegate<T> writeTo)
Parameters
Type | Name | Description |
---|---|---|
MemoryMap | file | |
Stream | stream | |
MemoryMap.ReadFromDelegate<T> | readFrom | |
MemoryMap.WriteToDelegate<T> | writeTo |
Methods
ReadFrom(Stream, Int64, ref T)
Reads appropriate amount of bytes from the stream at the given position and returns the structure.
Declaration
public override long ReadFrom(Stream stream, long position, ref T structure)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | |
System.Int64 | position | |
T | structure |
Returns
Type | Description |
---|---|
System.Int64 |
Overrides
Mars.Common.IO.Mapped.MappedAccessor<T>.ReadFrom(Stream, System.Int64, T)
WriteTo(Stream, Int64, ref T)
Converts the structure to bytes and writes them to the stream.
Declaration
public override long WriteTo(Stream stream, long position, ref T structure)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | |
System.Int64 | position | |
T | structure |
Returns
Type | Description |
---|---|
System.Int64 |
Overrides
Mars.Common.IO.Mapped.MappedAccessor<T>.WriteTo(Stream, System.Int64, T)