summary refs log tree commit diff
path: root/crypto/src/cms/CMSContentInfoParser.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 13:46:52 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 13:46:52 +0700
commit43047794022f233577135285cf7a6aa6905ab65e (patch)
tree2a82f3ede3151e3eef177bda6e2988475022ecb7 /crypto/src/cms/CMSContentInfoParser.cs
parentCleanup (diff)
downloadBouncyCastle.NET-ed25519-43047794022f233577135285cf7a6aa6905ab65e.tar.xz
CmsContentInfoParser implements IDisposable
- Obsolete the Close method
Diffstat (limited to 'crypto/src/cms/CMSContentInfoParser.cs')
-rw-r--r--crypto/src/cms/CMSContentInfoParser.cs27
1 files changed, 21 insertions, 6 deletions
diff --git a/crypto/src/cms/CMSContentInfoParser.cs b/crypto/src/cms/CMSContentInfoParser.cs
index c3bc9e736..86c7f459e 100644
--- a/crypto/src/cms/CMSContentInfoParser.cs
+++ b/crypto/src/cms/CMSContentInfoParser.cs
@@ -3,11 +3,11 @@ using System.IO;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Cms;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Cms
 {
 	public class CmsContentInfoParser
+		: IDisposable
 	{
 		protected ContentInfoParser	contentInfo;
 		protected Stream data;
@@ -36,13 +36,28 @@ namespace Org.BouncyCastle.Cms
 			}
 		}
 
-		/**
-		* Close the underlying data stream.
-		* @throws IOException if the close fails.
-		*/
+		[Obsolete("Dispose instead")]
 		public void Close()
 		{
-            data.Dispose();
+            Dispose();
 		}
+
+		#region IDisposable
+
+		public void Dispose()
+		{
+			Dispose(true);
+			GC.SuppressFinalize(this);
+		}
+
+		protected virtual void Dispose(bool disposing)
+		{
+			if (disposing)
+			{
+				data.Dispose();
+			}
+		}
+
+		#endregion
 	}
 }