summary refs log tree commit diff
path: root/crypto/src/util/io
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-30 10:33:35 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-30 10:33:35 +0700
commit1d31e90574c9dc8060670773a99c8a9ea5b2827c (patch)
tree50c520a5e0bd14dab5e5ad85cdc5dd5e8928ff56 /crypto/src/util/io
parentCleanup Stream disposing in Bcpg (diff)
downloadBouncyCastle.NET-ed25519-1d31e90574c9dc8060670773a99c8a9ea5b2827c.tar.xz
Some PORTABLE cleanup
Diffstat (limited to 'crypto/src/util/io')
-rw-r--r--crypto/src/util/io/FilterStream.cs35
1 files changed, 17 insertions, 18 deletions
diff --git a/crypto/src/util/io/FilterStream.cs b/crypto/src/util/io/FilterStream.cs
index a92dee3e5..0db82ec88 100644
--- a/crypto/src/util/io/FilterStream.cs
+++ b/crypto/src/util/io/FilterStream.cs
@@ -1,13 +1,29 @@
+using System;
 using System.IO;
 
 namespace Org.BouncyCastle.Utilities.IO
 {
-    public class FilterStream : Stream
+    public class FilterStream
+        : Stream
     {
+        protected readonly Stream s;
+
         public FilterStream(Stream s)
         {
+            if (s == null)
+                throw new ArgumentNullException(nameof(s));
+
             this.s = s;
         }
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                s.Dispose();
+            }
+
+            base.Dispose(disposing);
+        }
         public override bool CanRead
         {
             get { return s.CanRead; }
@@ -29,22 +45,6 @@ namespace Org.BouncyCastle.Utilities.IO
             get { return s.Position; }
             set { s.Position = value; }
         }
-#if PORTABLE
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing)
-            {
-                Platform.Dispose(s);
-            }
-            base.Dispose(disposing);
-        }
-#else
-        public override void Close()
-        {
-            Platform.Dispose(s);
-            base.Close();
-        }
-#endif
         public override void Flush()
         {
             s.Flush();
@@ -73,6 +73,5 @@ namespace Org.BouncyCastle.Utilities.IO
         {
             s.WriteByte(value);
         }
-        protected readonly Stream s;
     }
 }