< Summary - Jellyfin

Information
Class: Jellyfin.Extensions.FormattingStreamWriter
Assembly: Jellyfin.Extensions
File(s): /srv/git/jellyfin/src/Jellyfin.Extensions/FormattingStreamWriter.cs
Line coverage
57%
Covered lines: 4
Uncovered lines: 3
Coverable lines: 7
Total lines: 38
Line coverage: 57.1%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%210%
get_FormatProvider()100%11100%

File(s)

/srv/git/jellyfin/src/Jellyfin.Extensions/FormattingStreamWriter.cs

#LineLine coverage
 1using System;
 2using System.IO;
 3
 4namespace Jellyfin.Extensions;
 5
 6/// <summary>
 7/// A custom StreamWriter which supports setting a IFormatProvider.
 8/// </summary>
 9public class FormattingStreamWriter : StreamWriter
 10{
 11    private readonly IFormatProvider _formatProvider;
 12
 13    /// <summary>
 14    /// Initializes a new instance of the <see cref="FormattingStreamWriter"/> class.
 15    /// </summary>
 16    /// <param name="stream">The stream to write to.</param>
 17    /// <param name="formatProvider">The format provider to use.</param>
 18    public FormattingStreamWriter(Stream stream, IFormatProvider formatProvider)
 119        : base(stream)
 20    {
 121        _formatProvider = formatProvider;
 122    }
 23
 24    /// <summary>
 25    /// Initializes a new instance of the <see cref="FormattingStreamWriter"/> class.
 26    /// </summary>
 27    /// <param name="path">The complete file path to write to.</param>
 28    /// <param name="formatProvider">The format provider to use.</param>
 29    public FormattingStreamWriter(string path, IFormatProvider formatProvider)
 030        : base(path)
 31    {
 032        _formatProvider = formatProvider;
 033    }
 34
 35    /// <inheritdoc />
 36    public override IFormatProvider FormatProvider
 137        => _formatProvider;
 38}