Represents a stream over the storage that supports random access.
InheritanceRandomAccessStream
Namespace: DotNext.IO Assembly: DotNext.IO.dll Syntaxpublic abstract class RandomAccessStream : Stream, IAsyncDisposable, IDisposable, IFlushable, IValueTaskSource, IValueTaskSource<int>
Properties | Edit this page View Source CanSeek
When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
Declarationpublic override bool CanSeek { get; }
Property Value Type Description bool
true if the stream supports seeking; otherwise, false.
Overrides | Edit this page View Source PositionWhen overridden in a derived class, gets or sets the position within the current stream.
Declarationpublic override sealed long Position { get; set; }
Property Value Type Description long
The current position within the stream.
Overrides Exceptions Methods | Edit this page View Source Dispose(bool)Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
Declarationprotected override void Dispose(bool disposing)
Parameters Type Name Description bool disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Overrides | Edit this page View Source Read(byte[], int, int)When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
Declarationpublic override sealed int Read(byte[] buffer, int offset, int count)
Parameters Type Name Description byte[] buffer
An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset
and (offset
+ count
- 1) replaced by the bytes read from the current source.
The zero-based byte offset in buffer
at which to begin storing the data read from the current stream.
The maximum number of bytes to be read from the current stream.
Returns Type Description intThe total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if count
is 0 or the end of the stream has been reached.
When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
Declarationpublic override sealed int Read(Span<byte> buffer)
Parameters Type Name Description Span<byte> buffer
A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the current source.
Returns Type Description intThe total number of bytes read into the buffer. This can be less than the size of the buffer if that many bytes are not currently available, or zero (0) if the buffer's length is zero or the end of the stream has been reached.
Overrides | Edit this page View Source Read(Span<byte>, long)Reads bytes to the specified buffer.
Declarationprotected abstract int Read(Span<byte> buffer, long offset)
Parameters Type Name Description Span<byte> buffer
The buffer to be modified.
long offsetThe offset within the underlying data storage.
Returns Type Description intThe number of bytes read.
| Edit this page View Source ReadAsync(byte[], int, int, CancellationToken)Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
Declarationpublic override sealed Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken token)
Parameters Type Name Description byte[] buffer
The buffer to write the data into.
int offsetThe byte offset in buffer
at which to begin writing data from the stream.
The maximum number of bytes to read.
CancellationToken token Returns Type Description Task<int>A task that represents the asynchronous read operation. The value of the TResult
parameter contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if count
is 0 or if the end of the stream has been reached.
Reads bytes to the specified buffer.
Declarationprotected abstract ValueTask<int> ReadAsync(Memory<byte> buffer, long offset, CancellationToken token)
Parameters Type Name Description Memory<byte> buffer
The buffer to be modified.
long offsetThe offset within the underlying data storage.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns | Edit this page View Source ReadAsync(Memory<byte>, CancellationToken)Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
Declarationpublic override sealed ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken token = default)
Parameters Returns Type Description ValueTask<int>
A task that represents the asynchronous read operation. The value of its Result property contains the total number of bytes read into the buffer. The result value can be less than the length of the buffer if that many bytes are not currently available, or it can be 0 (zero) if the length of the buffer is 0 or if the end of the stream has been reached.
Overrides | Edit this page View Source ReadByte()Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
Declarationpublic override sealed int ReadByte()
Returns Type Description int
The unsigned byte cast to an int, or -1 if at the end of the stream.
Overrides Exceptions | Edit this page View Source Seek(long, SeekOrigin)When overridden in a derived class, sets the position within the current stream.
Declarationpublic override long Seek(long offset, SeekOrigin origin)
Parameters Type Name Description long offset
A byte offset relative to the origin
parameter.
A value of type SeekOrigin indicating the reference point used to obtain the new position.
Returns Type Description longThe new position within the current stream.
Overrides Exceptions | Edit this page View Source Write(byte[], int, int)When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
Declarationpublic override sealed void Write(byte[] buffer, int offset, int count)
Parameters Type Name Description byte[] buffer
An array of bytes. This method copies count
bytes from buffer
to the current stream.
The zero-based byte offset in buffer
at which to begin copying bytes to the current stream.
The number of bytes to be written to the current stream.
Overrides Exceptions | Edit this page View Source Write(ReadOnlySpan<byte>)When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
Declarationpublic override sealed void Write(ReadOnlySpan<byte> buffer)
Parameters Type Name Description ReadOnlySpan<byte> buffer
A region of memory. This method copies the contents of this region to the current stream.
Overrides | Edit this page View Source Write(ReadOnlySpan<byte>, long)Writes the bytes at the specified offset.
Declarationprotected abstract void Write(ReadOnlySpan<byte> buffer, long offset)
Parameters Type Name Description ReadOnlySpan<byte> buffer
The buffer to write.
long offsetThe offset within the underlying data storage.
| Edit this page View Source WriteAsync(byte[], int, int, CancellationToken)Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
Declarationpublic override sealed Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken token)
Parameters Type Name Description byte[] buffer
The buffer to write data from.
int offsetThe zero-based byte offset in buffer
from which to begin copying bytes to the stream.
The maximum number of bytes to write.
CancellationToken token Returns Type Description TaskA task that represents the asynchronous write operation.
Overrides Exceptions | Edit this page View Source WriteAsync(ReadOnlyMemory<byte>, long, CancellationToken)Writes the bytes at the specified offset.
Declarationprotected abstract ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, long offset, CancellationToken token)
Parameters Type Name Description ReadOnlyMemory<byte> buffer
The buffer to write.
long offsetThe offset within the underlying data storage.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTaskThe task representing asynchronous operation.
| Edit this page View Source WriteAsync(ReadOnlyMemory<byte>, CancellationToken)Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
Declarationpublic override sealed ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken token = default)
Parameters Returns Type Description ValueTask
A task that represents the asynchronous write operation.
Overrides | Edit this page View Source WriteByte(byte)Writes a byte to the current position in the stream and advances the position within the stream by one byte.
Declarationpublic override sealed void WriteByte(byte value)
Parameters Type Name Description byte value
The byte to write to the stream.
Overrides Exceptions Implements Extension Methods StreamExtensions.ParseAsync<TArg, TResult>(Stream, TArg, ReadOnlySpanFunc<char, TArg, TResult>, DecodingContext, LengthFormat, Memory<byte>, MemoryAllocator<char>?, CancellationToken)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4