@@ -3,6 +3,7 @@ namespace Just.Core.Extensions;
|
||||
/// <summary>
|
||||
/// Provides extension methods for <see cref="Stream"/> to fully populate buffers.
|
||||
/// </summary>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static class SystemIOStreamExtensions
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,6 +17,7 @@ public static class SystemIOStreamExtensions
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="offset"/> or <paramref name="length"/> is invalid</exception>
|
||||
/// <exception cref="EndOfStreamException">Thrown if the stream ends before filling the buffer</exception>
|
||||
/// <exception cref="IOException">Thrown for I/O errors during reading</exception>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static void Populate(this Stream stream, byte[] buffer, int offset, int length)
|
||||
=> stream.Populate(buffer.AsSpan(offset, length));
|
||||
/// <summary>
|
||||
@@ -26,6 +28,7 @@ public static class SystemIOStreamExtensions
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stream"/> is null</exception>
|
||||
/// <exception cref="EndOfStreamException">Thrown if the stream ends before filling the buffer</exception>
|
||||
/// <exception cref="IOException">Thrown for I/O errors during reading</exception>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static void Populate(this Stream stream, byte[] buffer)
|
||||
=> stream.Populate(buffer.AsSpan());
|
||||
/// <summary>
|
||||
@@ -36,6 +39,7 @@ public static class SystemIOStreamExtensions
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stream"/> is null</exception>
|
||||
/// <exception cref="EndOfStreamException">Thrown if the stream ends before filling the buffer</exception>
|
||||
/// <exception cref="IOException">Thrown for I/O errors during reading</exception>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static void Populate(this Stream stream, Span<byte> buffer)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
@@ -64,6 +68,7 @@ public static class SystemIOStreamExtensions
|
||||
/// <exception cref="EndOfStreamException">Thrown if the stream ends before filling the buffer</exception>
|
||||
/// <exception cref="OperationCanceledException">Thrown if canceled via cancellation token</exception>
|
||||
/// <exception cref="IOException">Thrown for I/O errors during reading</exception>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static ValueTask PopulateAsync(this Stream stream, byte[] buffer, CancellationToken cancellationToken = default)
|
||||
=> stream.PopulateAsync(buffer.AsMemory(), cancellationToken);
|
||||
/// <summary>
|
||||
@@ -80,6 +85,7 @@ public static class SystemIOStreamExtensions
|
||||
/// <exception cref="EndOfStreamException">Thrown if the stream ends before filling the buffer</exception>
|
||||
/// <exception cref="OperationCanceledException">Thrown if canceled via cancellation token</exception>
|
||||
/// <exception cref="IOException">Thrown for I/O errors during reading</exception>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static ValueTask PopulateAsync(this Stream stream, byte[] buffer, int offset, int length, CancellationToken cancellationToken = default)
|
||||
=> stream.PopulateAsync(buffer.AsMemory(offset, length), cancellationToken);
|
||||
/// <summary>
|
||||
@@ -93,6 +99,7 @@ public static class SystemIOStreamExtensions
|
||||
/// <exception cref="EndOfStreamException">Thrown if the stream ends before filling the buffer</exception>
|
||||
/// <exception cref="OperationCanceledException">Thrown if canceled via cancellation token</exception>
|
||||
/// <exception cref="IOException">Thrown for I/O errors during reading</exception>
|
||||
[Obsolete("Stream.ReadExactly and Stream.ReadExactlyAsync have the same functionality. Will be removed in the next version.")]
|
||||
public static async ValueTask PopulateAsync(this Stream stream, Memory<byte> buffer, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
|
||||
Reference in New Issue
Block a user