< Summary

Information
Class: System.Net.Http.EmptyReadStream
Assembly: System.Net.Http
File(s): D:\runner\runtime\src\libraries\System.Net.Http\src\System\Net\Http\EmptyReadStream.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 15
Coverable lines: 15
Total lines: 38
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%
Dispose(...)100%110%
Close()100%110%
Read(...)100%110%
ReadAsync(...)0%220%
CopyToAsync(...)100%110%
Write(...)100%110%
WriteAsync(...)100%110%

File(s)

D:\runner\runtime\src\libraries\System.Net.Http\src\System\Net\Http\EmptyReadStream.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.IO;
 5using System.Threading;
 6using System.Threading.Tasks;
 7
 8namespace System.Net.Http
 9{
 10    internal sealed class EmptyReadStream : HttpBaseStream
 11    {
 012        internal static EmptyReadStream Instance { get; } = new EmptyReadStream();
 13
 014        private EmptyReadStream() { }
 15
 016        public override bool CanRead => true;
 017        public override bool CanWrite => false;
 18
 019        protected override void Dispose(bool disposing) {  /* nop */ }
 020        public override void Close() { /* nop */ }
 21
 022        public override int Read(Span<byte> buffer) => 0;
 23
 24        public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken) =>
 025            cancellationToken.IsCancellationRequested ? ValueTask.FromCanceled<int>(cancellationToken) :
 026            new ValueTask<int>(0);
 27
 28        public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
 029        {
 030            ValidateCopyToArguments(destination, bufferSize);
 031            return NopAsync(cancellationToken);
 032        }
 33
 034        public override void Write(ReadOnlySpan<byte> buffer) => throw new NotSupportedException(SR.net_http_content_rea
 35
 036        public override ValueTask WriteAsync(ReadOnlyMemory<byte> destination, CancellationToken cancellationToken) => t
 37    }
 38}