summary refs log tree commit diff
path: root/crypto/src/openpgp/WrappedGeneratorStream.cs
blob: c973d0b0298d58388bd51c6186372c5f30b9744a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.IO;

using Org.BouncyCastle.Utilities.IO;

namespace Org.BouncyCastle.Bcpg.OpenPgp
{
	internal sealed class WrappedGeneratorStream
		: FilterStream
	{
		private readonly IStreamGenerator m_generator;

		internal WrappedGeneratorStream(IStreamGenerator generator, Stream s)
			: base(s)
		{
			m_generator = generator ?? throw new ArgumentNullException(nameof(generator));
		}

        protected override void Dispose(bool disposing)
        {
			if (disposing)
			{
#pragma warning disable CS0618 // Type or member is obsolete
				m_generator.Close();
#pragma warning restore CS0618 // Type or member is obsolete
			}

			Detach(disposing);
		}
	}
}