summary refs log tree commit diff
path: root/crypto/src/util/io
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/util/io')
-rw-r--r--crypto/src/util/io/BaseInputStream.cs4
-rw-r--r--crypto/src/util/io/BaseOutputStream.cs6
-rw-r--r--crypto/src/util/io/FilterStream.cs4
-rw-r--r--crypto/src/util/io/PushbackStream.cs4
-rw-r--r--crypto/src/util/io/Streams.cs6
5 files changed, 23 insertions, 1 deletions
diff --git a/crypto/src/util/io/BaseInputStream.cs b/crypto/src/util/io/BaseInputStream.cs
index 8f5265fee..438583c75 100644
--- a/crypto/src/util/io/BaseInputStream.cs
+++ b/crypto/src/util/io/BaseInputStream.cs
@@ -1,7 +1,9 @@
 using System;
 using System.IO;
 using System.Threading;
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
 using System.Threading.Tasks;
+#endif
 
 namespace Org.BouncyCastle.Utilities.IO
 {
@@ -19,10 +21,12 @@ namespace Org.BouncyCastle.Utilities.IO
         }
 #endif
 
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
         {
             return Streams.CopyToAsync(this, destination, bufferSize, cancellationToken);
         }
+#endif
 
         public sealed override void Flush() {}
         public sealed override long Length { get { throw new NotSupportedException(); } }
diff --git a/crypto/src/util/io/BaseOutputStream.cs b/crypto/src/util/io/BaseOutputStream.cs
index 87a850c35..72234b817 100644
--- a/crypto/src/util/io/BaseOutputStream.cs
+++ b/crypto/src/util/io/BaseOutputStream.cs
@@ -1,7 +1,9 @@
 using System;
 using System.IO;
 using System.Threading;
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
 using System.Threading.Tasks;
+#endif
 
 namespace Org.BouncyCastle.Utilities.IO
 {
@@ -16,11 +18,15 @@ namespace Org.BouncyCastle.Utilities.IO
         // TODO[api] sealed
         public override void CopyTo(Stream destination, int bufferSize) { throw new NotSupportedException(); }
 #endif
+
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         // TODO[api] sealed
         public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
         {
             throw new NotSupportedException();
         }
+#endif
+
         public override void Flush() {}
         public sealed override long Length { get { throw new NotSupportedException(); } }
         public sealed override long Position
diff --git a/crypto/src/util/io/FilterStream.cs b/crypto/src/util/io/FilterStream.cs
index 630bdc22f..8fb6d9df4 100644
--- a/crypto/src/util/io/FilterStream.cs
+++ b/crypto/src/util/io/FilterStream.cs
@@ -1,7 +1,9 @@
 using System;
 using System.IO;
 using System.Threading;
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
 using System.Threading.Tasks;
+#endif
 
 namespace Org.BouncyCastle.Utilities.IO
 {
@@ -32,10 +34,12 @@ namespace Org.BouncyCastle.Utilities.IO
             Streams.CopyTo(s, destination, bufferSize);
         }
 #endif
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
         {
             return Streams.CopyToAsync(s, destination, bufferSize, cancellationToken);
         }
+#endif
         public override void Flush()
         {
             s.Flush();
diff --git a/crypto/src/util/io/PushbackStream.cs b/crypto/src/util/io/PushbackStream.cs
index be6b26d4c..452019805 100644
--- a/crypto/src/util/io/PushbackStream.cs
+++ b/crypto/src/util/io/PushbackStream.cs
@@ -1,7 +1,9 @@
 using System;
 using System.IO;
 using System.Threading;
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
 using System.Threading.Tasks;
+#endif
 
 namespace Org.BouncyCastle.Utilities.IO
 {
@@ -28,6 +30,7 @@ namespace Org.BouncyCastle.Utilities.IO
         }
 #endif
 
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
         {
             if (m_buf != -1)
@@ -39,6 +42,7 @@ namespace Org.BouncyCastle.Utilities.IO
 
             await Streams.CopyToAsync(s, destination, bufferSize, cancellationToken);
         }
+#endif
 
         public override int Read(byte[] buffer, int offset, int count)
 		{
diff --git a/crypto/src/util/io/Streams.cs b/crypto/src/util/io/Streams.cs
index 69f390646..a1a2ea5d1 100644
--- a/crypto/src/util/io/Streams.cs
+++ b/crypto/src/util/io/Streams.cs
@@ -2,13 +2,15 @@ using System;
 using System.IO;
 using System.Runtime.InteropServices;
 using System.Threading;
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
 using System.Threading.Tasks;
+#endif
 
 namespace Org.BouncyCastle.Utilities.IO
 {
     public static class Streams
 	{
-        private static readonly int MaxStackAlloc = Environment.Is64BitProcess ? 4096 : 1024;
+        private static readonly int MaxStackAlloc = Platform.Is64BitProcess ? 4096 : 1024;
 
 		public static int DefaultBufferSize => MaxStackAlloc;
 
@@ -37,6 +39,7 @@ namespace Org.BouncyCastle.Utilities.IO
 #endif
 		}
 
+#if NETCOREAPP1_0_OR_GREATER || NET45_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         public static Task CopyToAsync(Stream source, Stream destination)
         {
             return CopyToAsync(source, destination, DefaultBufferSize);
@@ -69,6 +72,7 @@ namespace Org.BouncyCastle.Utilities.IO
 			}
 #endif
 		}
+#endif
 
         public static void Drain(Stream inStr)
 		{