summary refs log tree commit diff
path: root/crypto/src/openpgp/WrappedGeneratorStream.cs
blob: c985a7a05e6c5b7efae3917e7eefebf1c36c5f6a (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
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)
			{
				m_generator.Dispose();
			}

			Detach(disposing);
		}
	}
}