Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/spongycastle/asn1/DLOutputStream.java')
-rw-r--r--core/src/main/java/org/spongycastle/asn1/DLOutputStream.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/core/src/main/java/org/spongycastle/asn1/DLOutputStream.java b/core/src/main/java/org/spongycastle/asn1/DLOutputStream.java
new file mode 100644
index 00000000..cb401e83
--- /dev/null
+++ b/core/src/main/java/org/spongycastle/asn1/DLOutputStream.java
@@ -0,0 +1,31 @@
+package org.spongycastle.asn1;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Stream that outputs encoding based on definite length.
+ */
+public class DLOutputStream
+ extends ASN1OutputStream
+{
+ public DLOutputStream(
+ OutputStream os)
+ {
+ super(os);
+ }
+
+ public void writeObject(
+ ASN1Encodable obj)
+ throws IOException
+ {
+ if (obj != null)
+ {
+ obj.toASN1Primitive().toDLObject().encode(this);
+ }
+ else
+ {
+ throw new IOException("null object detected");
+ }
+ }
+}