diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-04 19:28:43 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-04 19:28:43 +0700 |
commit | f56fc16973d66bd9461f247e50738e55bd54de7e (patch) | |
tree | 8e84c9bd2cfc2d554b99c8045ec46de7313410fc /crypto/src/util/zlib/ZOutputStream.cs | |
parent | Port updated revocation test from Java (diff) | |
download | BouncyCastle.NET-ed25519-f56fc16973d66bd9461f247e50738e55bd54de7e.tar.xz |
Replace Close with Dispose for PORTABLE
Diffstat (limited to 'crypto/src/util/zlib/ZOutputStream.cs')
-rw-r--r-- | crypto/src/util/zlib/ZOutputStream.cs | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/crypto/src/util/zlib/ZOutputStream.cs b/crypto/src/util/zlib/ZOutputStream.cs index 7b49d6638..ca59d8e1f 100644 --- a/crypto/src/util/zlib/ZOutputStream.cs +++ b/crypto/src/util/zlib/ZOutputStream.cs @@ -95,32 +95,51 @@ namespace Org.BouncyCastle.Utilities.Zlib public sealed override bool CanSeek { get { return false; } } public sealed override bool CanWrite { get { return !closed; } } +#if PORTABLE + protected override void Disposing(bool disposing) + { + if (disposing) + { + if (this.closed) + return; + + DoClose(); + } + base.Dispose(disposing); + } +#else public override void Close() { if (this.closed) return; - try - { - try - { - Finish(); - } - catch (IOException) - { - // Ignore - } - } - finally - { - this.closed = true; - End(); - Platform.Dispose(output); - output = null; - } + DoClose(); } +#endif + + private void DoClose() + { + try + { + try + { + Finish(); + } + catch (IOException) + { + // Ignore + } + } + finally + { + this.closed = true; + End(); + Platform.Dispose(output); + output = null; + } + } - public virtual void End() + public virtual void End() { if (z == null) return; |