summaryrefslogtreecommitdiffstats
path: root/bcpkix/src/main/java/org/bouncycastle/cms/CMSTypedStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'bcpkix/src/main/java/org/bouncycastle/cms/CMSTypedStream.java')
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/CMSTypedStream.java86
1 files changed, 0 insertions, 86 deletions
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/CMSTypedStream.java b/bcpkix/src/main/java/org/bouncycastle/cms/CMSTypedStream.java
deleted file mode 100644
index eda3bde..0000000
--- a/bcpkix/src/main/java/org/bouncycastle/cms/CMSTypedStream.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.bouncycastle.cms;
-
-import java.io.BufferedInputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.util.io.Streams;
-
-public class CMSTypedStream
-{
- private static final int BUF_SIZ = 32 * 1024;
-
- private final ASN1ObjectIdentifier _oid;
- private final InputStream _in;
-
- public CMSTypedStream(
- InputStream in)
- {
- this(PKCSObjectIdentifiers.data.getId(), in, BUF_SIZ);
- }
-
- public CMSTypedStream(
- String oid,
- InputStream in)
- {
- this(new ASN1ObjectIdentifier(oid), in, BUF_SIZ);
- }
-
- public CMSTypedStream(
- String oid,
- InputStream in,
- int bufSize)
- {
- this(new ASN1ObjectIdentifier(oid), in, bufSize);
- }
-
- public CMSTypedStream(
- ASN1ObjectIdentifier oid,
- InputStream in)
- {
- this(oid, in, BUF_SIZ);
- }
-
- public CMSTypedStream(
- ASN1ObjectIdentifier oid,
- InputStream in,
- int bufSize)
- {
- _oid = oid;
- _in = new FullReaderStream(new BufferedInputStream(in, bufSize));
- }
-
- public ASN1ObjectIdentifier getContentType()
- {
- return _oid;
- }
-
- public InputStream getContentStream()
- {
- return _in;
- }
-
- public void drain()
- throws IOException
- {
- Streams.drain(_in);
- _in.close();
- }
-
- private static class FullReaderStream extends FilterInputStream
- {
- FullReaderStream(InputStream in)
- {
- super(in);
- }
-
- public int read(byte[] buf, int off, int len) throws IOException
- {
- int totalRead = Streams.readFully(super.in, buf, off, len);
- return totalRead > 0 ? totalRead : -1;
- }
- }
-}