summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/asn1/Asn1OutputStream.cs25
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);
             }
         }