Class ReadOnlySequenceAccessor
Represents factory of ReadOnlySequence<T> objects representing memory-mapped file content.
Implements
Inherited Members
Namespace: DotNext.IO.MemoryMappedFiles
Assembly: DotNext.IO.dll
Syntax
public sealed class ReadOnlySequenceAccessor : Disposable, IReadOnlySequenceSource<byte>, IDisposable, ISupplier<ReadOnlySequence<byte>>, IFunctional<Func<ReadOnlySequence<byte>>>
Remarks
A sequence returned by Sequence property should not be accessed concurrently. For concurrent access, you need to obtain a new instance of ReadOnlySequenceAccessor class. The class uses lazy initialization of memory-mapped file segment every time when ReadOnlySequence<T> switching between segments.
Constructors
| Edit this page View SourceReadOnlySequenceAccessor(FileStream, int)
Initializes a new accessor over memory-mapped file segments represented as ReadOnlySequence<T>.
Declaration
public ReadOnlySequenceAccessor(FileStream file, int segmentSize)
Parameters
Type | Name | Description |
---|---|---|
FileStream | file | The file stream. |
int | segmentSize | The size of single segment, in bytes, that can be returned by ReadOnlySequence<T> as contiguous block of memory. So this parameter defines actual amount of occupied virtual memory. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
ReadOnlySequenceAccessor(MemoryMappedFile, int, long)
Initializes a new accessor over memory-mapped file segments represented as ReadOnlySequence<T>.
Declaration
public ReadOnlySequenceAccessor(MemoryMappedFile file, int segmentSize, long size)
Parameters
Type | Name | Description |
---|---|---|
MemoryMappedFile | file | The memory-mapped file. |
int | segmentSize | The size of single segment, in bytes, that can be returned by ReadOnlySequence<T> as contiguous block of memory. So this parameter defines actual amount of occupied virtual memory. |
long | size | The observable length, in bytes, of memory-mapped file. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
Properties
| Edit this page View SourceSequence
Gets the sequence of memory-mapped file fragments.
Declaration
public ReadOnlySequence<byte> Sequence { get; }
Property Value
Type | Description |
---|---|
ReadOnlySequence<byte> |
Remarks
The sequence produced by this instance should not be accessed concurrently.
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | This object has been disposed. |
Methods
| Edit this page View SourceDispose(bool)
Releases managed and unmanaged resources associated with this object.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true if called from Dispose(); false if called from finalizer ~Disposable(). |