summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-03-09 17:13:07 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-03-09 17:13:07 +0700
commitffcabe4eb28c4ba960b6e7ceb692d6aec0ee8941 (patch)
treec821cf39fce2296c3cd02c5460dc7449cf9281cc
parentRefactoring around Stream usage (diff)
downloadBouncyCastle.NET-ed25519-ffcabe4eb28c4ba960b6e7ceb692d6aec0ee8941.tar.xz
Remove unnecessary methods
-rw-r--r--crypto/src/util/io/Streams.cs34
1 files changed, 6 insertions, 28 deletions
diff --git a/crypto/src/util/io/Streams.cs b/crypto/src/util/io/Streams.cs
index b975d03bd..69f390646 100644
--- a/crypto/src/util/io/Streams.cs
+++ b/crypto/src/util/io/Streams.cs
@@ -63,9 +63,9 @@ namespace Org.BouncyCastle.Utilities.IO
 				await WriteAsync(destination, new ReadOnlyMemory<byte>(buffer, 0, bytesRead), cancellationToken).ConfigureAwait(false);
 			}
 #else
-			while ((bytesRead = await ReadAsync(source, buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
+			while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0)
 			{
-				await WriteAsync(destination, buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
+				await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
 			}
 #endif
 		}
@@ -140,17 +140,6 @@ namespace Org.BouncyCastle.Utilities.IO
 			return buf.ToArray();
 		}
 
-        public static Task<int> ReadAsync(Stream source, byte[] buffer, int offset, int count)
-        {
-            return source.ReadAsync(buffer, offset, count);
-        }
-
-        public static Task<int> ReadAsync(Stream source, byte[] buffer, int offset, int count,
-            CancellationToken cancellationToken)
-        {
-            return source.ReadAsync(buffer, offset, count, cancellationToken);
-        }
-
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
         public static ValueTask<int> ReadAsync(Stream source, Memory<byte> buffer,
 			CancellationToken cancellationToken = default)
@@ -158,11 +147,11 @@ namespace Org.BouncyCastle.Utilities.IO
             if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
             {
                 return new ValueTask<int>(
-                    ReadAsync(source, array.Array!, array.Offset, array.Count, cancellationToken));
+                    source.ReadAsync(array.Array!, array.Offset, array.Count, cancellationToken));
             }
 
             byte[] sharedBuffer = new byte[buffer.Length];
-			var readTask = ReadAsync(source, sharedBuffer, 0, buffer.Length, cancellationToken);
+			var readTask = source.ReadAsync(sharedBuffer, 0, buffer.Length, cancellationToken);
             return FinishReadAsync(readTask, sharedBuffer, buffer);
         }
 
@@ -227,17 +216,6 @@ namespace Org.BouncyCastle.Utilities.IO
 				throw new ArgumentOutOfRangeException("count");
 		}
 
-        public static Task WriteAsync(Stream destination, byte[] buffer, int offset, int count)
-        {
-            return destination.WriteAsync(buffer, offset, count);
-        }
-
-        public static Task WriteAsync(Stream destination, byte[] buffer, int offset, int count,
-            CancellationToken cancellationToken)
-        {
-            return destination.WriteAsync(buffer, offset, count, cancellationToken);
-        }
-
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
         public static ValueTask WriteAsync(Stream destination, ReadOnlyMemory<byte> buffer,
             CancellationToken cancellationToken = default)
@@ -245,11 +223,11 @@ namespace Org.BouncyCastle.Utilities.IO
             if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
             {
                 return new ValueTask(
-                    WriteAsync(destination, array.Array!, array.Offset, array.Count, cancellationToken));
+                    destination.WriteAsync(array.Array!, array.Offset, array.Count, cancellationToken));
             }
 
             byte[] sharedBuffer = buffer.ToArray();
-            var writeTask = WriteAsync(destination, sharedBuffer, 0, buffer.Length, cancellationToken);
+            var writeTask = destination.WriteAsync(sharedBuffer, 0, buffer.Length, cancellationToken);
             return new ValueTask(FinishWriteAsync(writeTask, sharedBuffer));
         }