diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-30 10:33:35 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-30 10:33:35 +0700 |
commit | 1d31e90574c9dc8060670773a99c8a9ea5b2827c (patch) | |
tree | 50c520a5e0bd14dab5e5ad85cdc5dd5e8928ff56 /crypto/src/util/io | |
parent | Cleanup Stream disposing in Bcpg (diff) | |
download | BouncyCastle.NET-ed25519-1d31e90574c9dc8060670773a99c8a9ea5b2827c.tar.xz |
Some PORTABLE cleanup
Diffstat (limited to 'crypto/src/util/io')
-rw-r--r-- | crypto/src/util/io/FilterStream.cs | 35 |
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; } } |