Replace Dump program with static utility method
2 files changed, 11 insertions, 30 deletions
diff --git a/crypto/src/asn1/util/Asn1Dump.cs b/crypto/src/asn1/util/Asn1Dump.cs
index 406511a72..64d88c373 100644
--- a/crypto/src/asn1/util/Asn1Dump.cs
+++ b/crypto/src/asn1/util/Asn1Dump.cs
@@ -243,6 +243,17 @@ namespace Org.BouncyCastle.Asn1.Utilities
}
}
+ /// <summary>Parse ASN.1 objects from input <see cref="Stream"/>, and write them to the output.</summary>
+ public static void Dump(Stream input, TextWriter output)
+ {
+ Asn1InputStream asn1InputStream = new Asn1InputStream(input);
+ Asn1Object asn1Object;
+ while ((asn1Object = asn1InputStream.ReadObject()) != null)
+ {
+ output.Write(DumpAsString(asn1Object));
+ }
+ }
+
/**
* dump out a DER object as a formatted string, in non-verbose mode
*
diff --git a/crypto/src/asn1/util/Dump.cs b/crypto/src/asn1/util/Dump.cs
deleted file mode 100644
index e313fe879..000000000
--- a/crypto/src/asn1/util/Dump.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-#if !PORTABLE
-using System;
-using System.IO;
-
-using Org.BouncyCastle.Utilities;
-
-namespace Org.BouncyCastle.Asn1.Utilities
-{
- public sealed class Dump
- {
- private Dump()
- {
- }
-
- public static void Main(string[] args)
- {
- FileStream fIn = File.OpenRead(args[0]);
- Asn1InputStream bIn = new Asn1InputStream(fIn);
-
- Asn1Object obj;
- while ((obj = bIn.ReadObject()) != null)
- {
- Console.WriteLine(Asn1Dump.DumpAsString(obj));
- }
-
- Platform.Dispose(bIn);
- }
- }
-}
-#endif
|