Class RandomAccessStream
Represents a stream over the storage that supports random access.
Inheritance
RandomAccessStream
Assembly: DotNext.IO.dll
Syntax
public abstract class RandomAccessStream : ModernStream, IDisposable, IAsyncDisposable, IFlushable, IValueTaskSource, IValueTaskSource<int>
Constructors
View Source
RandomAccessStream()
Declaration
protected RandomAccessStream()
Properties
View Source
CanSeek
Declaration
public override bool CanSeek { get; }
Property Value
Overrides
View Source
Position
Declaration
public override sealed long Position { get; set; }
Property Value
Overrides
Methods
View Source
Dispose(bool)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type |
Name |
Description |
| bool |
disposing |
|
Overrides
View Source
Read(Span<byte>)
Declaration
public override sealed int Read(Span<byte> buffer)
Parameters
Returns
Overrides
View Source
Read(Span<byte>, long)
Reads bytes to the specified buffer.
Declaration
protected abstract int Read(Span<byte> buffer, long offset)
Parameters
| Type |
Name |
Description |
| Span<byte> |
buffer |
The buffer to be modified.
|
| long |
offset |
The offset within the underlying data storage.
|
Returns
| Type |
Description |
| int |
The number of bytes read.
|
View Source
ReadAsync(Memory<byte>, long, CancellationToken)
Reads bytes to the specified buffer.
Declaration
protected abstract ValueTask<int> ReadAsync(Memory<byte> buffer, long offset, CancellationToken token)
Parameters
| Type |
Name |
Description |
| Memory<byte> |
buffer |
The buffer to be modified.
|
| long |
offset |
The offset within the underlying data storage.
|
| CancellationToken |
token |
The token that can be used to cancel the operation.
|
Returns
View Source
ReadAsync(Memory<byte>, CancellationToken)
Declaration
public override sealed ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken token = default)
Parameters
Returns
Overrides
View Source
Seek(long, SeekOrigin)
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Returns
Overrides
View Source
Write(ReadOnlySpan<byte>)
Declaration
public override sealed void Write(ReadOnlySpan<byte> buffer)
Parameters
Overrides
View Source
Write(ReadOnlySpan<byte>, long)
Writes the bytes at the specified offset.
Declaration
protected abstract void Write(ReadOnlySpan<byte> buffer, long offset)
Parameters
| Type |
Name |
Description |
| ReadOnlySpan<byte> |
buffer |
The buffer to write.
|
| long |
offset |
The offset within the underlying data storage.
|
View Source
WriteAsync(ReadOnlyMemory<byte>, long, CancellationToken)
Writes the bytes at the specified offset.
Declaration
protected abstract ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, long offset, CancellationToken token)
Parameters
| Type |
Name |
Description |
| ReadOnlyMemory<byte> |
buffer |
The buffer to write.
|
| long |
offset |
The offset within the underlying data storage.
|
| CancellationToken |
token |
The token that can be used to cancel the operation.
|
Returns
| Type |
Description |
| ValueTask |
The task representing asynchronous operation.
|
View Source
WriteAsync(ReadOnlyMemory<byte>, CancellationToken)
Declaration
public override sealed ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken token = default)
Parameters
Returns
Overrides
Implements
Extension Methods
StreamExtensions.ParseAsync<TArg, TResult>(Stream, TArg, Func<ReadOnlySpan<char>, TArg, TResult>, DecodingContext, LengthFormat, Memory<byte>, MemoryAllocator<char>?, CancellationToken)