01: package org.bouncycastle.cms;
02:
03: import org.bouncycastle.asn1.cms.ContentInfoParser;
04: import org.bouncycastle.asn1.ASN1StreamParser;
05: import org.bouncycastle.asn1.ASN1SequenceParser;
06:
07: import java.io.IOException;
08: import java.io.InputStream;
09:
10: public class CMSContentInfoParser {
11: protected ContentInfoParser _contentInfo;
12: protected InputStream _data;
13:
14: protected CMSContentInfoParser(InputStream data)
15: throws CMSException {
16: _data = data;
17:
18: try {
19: ASN1StreamParser in = new ASN1StreamParser(data, CMSUtils
20: .getMaximumMemory());
21:
22: _contentInfo = new ContentInfoParser(
23: (ASN1SequenceParser) in.readObject());
24: } catch (IOException e) {
25: throw new CMSException("IOException reading content.", e);
26: } catch (ClassCastException e) {
27: throw new CMSException(
28: "Unexpected object reading content.", e);
29: }
30: }
31:
32: /**
33: * Close the underlying data stream.
34: * @throws IOException if the close fails.
35: */
36: public void close() throws IOException {
37: _data.close();
38: }
39: }
|