aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/StreamExtensions.cs
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2021-06-22 21:09:54 -0400
committerPatrick Barron <barronpm@gmail.com>2021-06-23 20:22:12 -0400
commitae878fa051e73dd1df90f1fed3ca5f7ad28b7beb (patch)
tree8d590d6ae9aea9a84626fa31695f0ed47969e33d /MediaBrowser.Common/Extensions/StreamExtensions.cs
parentf96722fa749b94b8affbf75da5d6941cab219a84 (diff)
parent94056049131a8573d7a4d0690da04c0e8bc240ad (diff)
Merge branch 'master' into authenticationdb-efcore
# Conflicts: # Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs # Emby.Server.Implementations/Session/SessionManager.cs # Jellyfin.Server.Implementations/Security/AuthorizationContext.cs
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;
- }
- }
- }
-}