diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-11 20:19:15 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-11 20:19:15 +0700 |
commit | 908491386b8be704234f69047c5cba5c0aca7c20 (patch) | |
tree | 0303dc6bf2e8820d10bcb1622f1b8548a06f1c35 /crypto/src/asn1 | |
parent | Remove now-redundant workaround (diff) | |
download | BouncyCastle.NET-ed25519-908491386b8be704234f69047c5cba5c0aca7c20.tar.xz |
Refactoring
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/Asn1OutputStream.cs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/crypto/src/asn1/Asn1OutputStream.cs b/crypto/src/asn1/Asn1OutputStream.cs index 79ab84b74..eeca2754c 100644 --- a/crypto/src/asn1/Asn1OutputStream.cs +++ b/crypto/src/asn1/Asn1OutputStream.cs @@ -32,21 +32,21 @@ namespace Org.BouncyCastle.Asn1 { } - public override void WriteObject(Asn1Encodable encodable) + public override void WriteObject(Asn1Encodable asn1Encodable) { - if (null == encodable) - throw new IOException("null object detected"); + if (null == asn1Encodable) + throw new ArgumentNullException("asn1Encodable"); - WritePrimitive(encodable.ToAsn1Object(), true); + asn1Encodable.ToAsn1Object().Encode(this, true); FlushInternal(); } - public override void WriteObject(Asn1Object primitive) + public override void WriteObject(Asn1Object asn1Object) { - if (null == primitive) - throw new IOException("null object detected"); + if (null == asn1Object) + throw new ArgumentNullException("asn1Object"); - WritePrimitive(primitive, true); + asn1Object.Encode(this, true); FlushInternal(); } @@ -189,16 +189,11 @@ namespace Org.BouncyCastle.Asn1 } } - internal virtual void WritePrimitive(Asn1Object primitive, bool withID) - { - primitive.Encode(this, withID); - } - - internal virtual void WritePrimitives(Asn1Object[] primitives) + internal void WritePrimitives(Asn1Object[] primitives) { for (int i = 0, count = primitives.Length; i < count; ++i) { - WritePrimitive(primitives[i], true); + primitives[i].Encode(this, true); } } |