Show / Hide Table of Contents

Class ModernStream

Represents a modern base class for custom streams that requires only necessary abstract methods to work correctly.

Inheritance
object
MarshalByRefObject
Stream
ModernStream
FileBufferingWriter
MemorySegmentStream
PoolingBufferedStream
RandomAccessStream
Implements
IDisposable
IAsyncDisposable
IFlushable
Inherited Members
Stream.Null
Stream.CopyTo(Stream)
Stream.CopyTo(Stream, int)
Stream.CopyToAsync(Stream)
Stream.CopyToAsync(Stream, int)
Stream.CopyToAsync(Stream, CancellationToken)
Stream.CopyToAsync(Stream, int, CancellationToken)
Stream.Dispose()
Stream.Close()
Stream.Dispose(bool)
Stream.DisposeAsync()
Stream.Flush()
Stream.FlushAsync()
Stream.FlushAsync(CancellationToken)
Stream.CreateWaitHandle()
Stream.ReadAsync(byte[], int, int)
Stream.ReadExactlyAsync(Memory<byte>, CancellationToken)
Stream.ReadExactlyAsync(byte[], int, int, CancellationToken)
Stream.ReadAtLeastAsync(Memory<byte>, int, bool, CancellationToken)
Stream.WriteAsync(byte[], int, int)
Stream.Seek(long, SeekOrigin)
Stream.SetLength(long)
Stream.ReadExactly(Span<byte>)
Stream.ReadExactly(byte[], int, int)
Stream.ReadAtLeast(Span<byte>, int, bool)
Stream.Synchronized(Stream)
Stream.ObjectInvariant()
Stream.ValidateBufferArguments(byte[], int, int)
Stream.ValidateCopyToArguments(Stream, int)
Stream.CanRead
Stream.CanWrite
Stream.CanSeek
Stream.CanTimeout
Stream.Length
Stream.Position
Stream.ReadTimeout
Stream.WriteTimeout
MarshalByRefObject.GetLifetimeService()
MarshalByRefObject.InitializeLifetimeService()
MarshalByRefObject.MemberwiseClone(bool)
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.IO
Assembly: DotNext.dll
Syntax
public abstract class ModernStream : Stream, IDisposable, IAsyncDisposable, IFlushable

Constructors

View Source

ModernStream()

Declaration
protected ModernStream()

Methods

View Source

BeginRead(byte[], int, int, AsyncCallback?, object?)

Declaration
public override sealed IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
Parameters
Type Name Description
byte[] buffer
int offset
int count
AsyncCallback callback
object state
Returns
Type Description
IAsyncResult
Overrides
Stream.BeginRead(byte[], int, int, AsyncCallback, object)
View Source

BeginWrite(byte[], int, int, AsyncCallback?, object?)

Declaration
public override sealed IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
Parameters
Type Name Description
byte[] buffer
int offset
int count
AsyncCallback callback
object state
Returns
Type Description
IAsyncResult
Overrides
Stream.BeginWrite(byte[], int, int, AsyncCallback, object)
View Source

EndRead(IAsyncResult)

Declaration
public override sealed int EndRead(IAsyncResult asyncResult)
Parameters
Type Name Description
IAsyncResult asyncResult
Returns
Type Description
int
Overrides
Stream.EndRead(IAsyncResult)
View Source

EndWrite(IAsyncResult)

Declaration
public override sealed void EndWrite(IAsyncResult asyncResult)
Parameters
Type Name Description
IAsyncResult asyncResult
Overrides
Stream.EndWrite(IAsyncResult)
View Source

Read(byte[], int, int)

Declaration
public override sealed int Read(byte[] buffer, int offset, int count)
Parameters
Type Name Description
byte[] buffer
int offset
int count
Returns
Type Description
int
Overrides
Stream.Read(byte[], int, int)
View Source

Read(Span<byte>)

Declaration
public override abstract int Read(Span<byte> buffer)
Parameters
Type Name Description
Span<byte> buffer
Returns
Type Description
int
Overrides
Stream.Read(Span<byte>)
View Source

ReadAsync(byte[], int, int, CancellationToken)

Declaration
public override sealed Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken token)
Parameters
Type Name Description
byte[] buffer
int offset
int count
CancellationToken token
Returns
Type Description
Task<int>
Overrides
Stream.ReadAsync(byte[], int, int, CancellationToken)
View Source

ReadAsync(Memory<byte>, CancellationToken)

Declaration
public override abstract ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken token = default)
Parameters
Type Name Description
Memory<byte> buffer
CancellationToken token
Returns
Type Description
ValueTask<int>
Overrides
Stream.ReadAsync(Memory<byte>, CancellationToken)
View Source

ReadByte()

Declaration
public override sealed int ReadByte()
Returns
Type Description
int
Overrides
Stream.ReadByte()
View Source

Write(byte[], int, int)

Declaration
public override sealed void Write(byte[] buffer, int offset, int count)
Parameters
Type Name Description
byte[] buffer
int offset
int count
Overrides
Stream.Write(byte[], int, int)
View Source

Write(ReadOnlySpan<byte>)

Declaration
public override abstract void Write(ReadOnlySpan<byte> buffer)
Parameters
Type Name Description
ReadOnlySpan<byte> buffer
Overrides
Stream.Write(ReadOnlySpan<byte>)
View Source

WriteAsync(byte[], int, int, CancellationToken)

Declaration
public override sealed Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken token)
Parameters
Type Name Description
byte[] buffer
int offset
int count
CancellationToken token
Returns
Type Description
Task
Overrides
Stream.WriteAsync(byte[], int, int, CancellationToken)
View Source

WriteAsync(ReadOnlyMemory<byte>, CancellationToken)

Declaration
public override abstract ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken token = default)
Parameters
Type Name Description
ReadOnlyMemory<byte> buffer
CancellationToken token
Returns
Type Description
ValueTask
Overrides
Stream.WriteAsync(ReadOnlyMemory<byte>, CancellationToken)
View Source

WriteByte(byte)

Declaration
public override sealed void WriteByte(byte value)
Parameters
Type Name Description
byte value
Overrides
Stream.WriteByte(byte)

Implements

IDisposable
IAsyncDisposable
IFlushable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾