aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/StreamExtensions.cs
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2021-09-03 21:25:18 +0200
committercvium <clausvium@gmail.com>2021-09-03 21:25:18 +0200
commit048c478b0d9fbad3c7e6ef7fcbf8e6c2b91fc013 (patch)
treee30a5eba97deff4b82a89099d802e06a67ae329c /MediaBrowser.Common/Extensions/StreamExtensions.cs
parent02a56d8cf73e6745f651fe230520182f0398fae3 (diff)
parente83d7a866750405f790cc261d1894dc51c088bf4 (diff)
Merge branch 'master' into bug/authorization-header-issue
Diffstat (limited to 'MediaBrowser.Common/Extensions/StreamExtensions.cs')
-rw-r--r--MediaBrowser.Common/Extensions/StreamExtensions.cs63
1 files changed, 0 insertions, 63 deletions
diff --git a/MediaBrowser.Common/Extensions/StreamExtensions.cs b/MediaBrowser.Common/Extensions/StreamExtensions.cs
deleted file mode 100644
index 5cbf57d98..000000000
--- a/MediaBrowser.Common/Extensions/StreamExtensions.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-namespace MediaBrowser.Common.Extensions
-{
- /// <summary>
- /// Class BaseExtensions.
- /// </summary>
- public static class StreamExtensions
- {
- /// <summary>
- /// Reads all lines in the <see cref="Stream" />.
- /// </summary>
- /// <param name="stream">The <see cref="Stream" /> to read from.</param>
- /// <returns>All lines in the stream.</returns>
- public static string[] ReadAllLines(this Stream stream)
- => ReadAllLines(stream, Encoding.UTF8);
-
- /// <summary>
- /// Reads all lines in the <see cref="Stream" />.
- /// </summary>
- /// <param name="stream">The <see cref="Stream" /> to read from.</param>
- /// <param name="encoding">The character encoding to use.</param>
- /// <returns>All lines in the stream.</returns>
- public static string[] ReadAllLines(this Stream stream, Encoding encoding)
- {
- using (StreamReader reader = new StreamReader(stream, encoding))
- {
- return ReadAllLines(reader).ToArray();
- }
- }
-
- /// <summary>
- /// Reads all lines in the <see cref="TextReader" />.
- /// </summary>
- /// <param name="reader">The <see cref="TextReader" /> to read from.</param>
- /// <returns>All lines in the stream.</returns>
- public static IEnumerable<string> ReadAllLines(this TextReader reader)
- {
- string? line;
- while ((line = reader.ReadLine()) != null)
- {
- yield return line;
- }
- }
-
- /// <summary>
- /// Reads all lines in the <see cref="TextReader" />.
- /// </summary>
- /// <param name="reader">The <see cref="TextReader" /> to read from.</param>
- /// <returns>All lines in the stream.</returns>
- public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader)
- {
- string? line;
- while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null)
- {
- yield return line;
- }
- }
- }
-}