blob: 28fffc6ab6b843c3c86b407f6d4183535e1d3fa7 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
using System;
using System.IO;
namespace Org.BouncyCastle.Asn1
{
public abstract class Asn1Generator
: IDisposable
{
private Stream m_outStream;
protected Asn1Generator(Stream outStream)
{
m_outStream = outStream ?? throw new ArgumentNullException(nameof(outStream));
}
protected abstract void Finish();
protected Stream OutStream
{
get { return m_outStream ?? throw new InvalidOperationException(); }
}
public abstract void AddObject(Asn1Encodable obj);
public abstract void AddObject(Asn1Object obj);
public abstract Stream GetRawOutputStream();
#region IDisposable
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (m_outStream != null)
{
Finish();
m_outStream = null;
}
}
}
#endregion
}
}
|