Class CMSCompressedDataParser
java.lang.Object
org.bouncycastle.cms.CMSContentInfoParser
org.bouncycastle.cms.CMSCompressedDataParser
Class for reading a CMS Compressed Data stream.
CMSCompressedDataParser cp = new CMSCompressedDataParser(inputStream);
process(cp.getContent(new ZlibExpanderProvider()).getContentStream());
Note: this class does not introduce buffering - if you are processing large files you should create
the parser with:
CMSCompressedDataParser ep = new CMSCompressedDataParser(new BufferedInputStream(inputStream, bufSize));
where bufSize is a suitably large buffer size.
Stream handling note:
- The constructor reads only the outer CMS ContentInfo header from the
supplied InputStream. The compressed content is drained lazily by the
caller via
getContent(InputExpanderProvider)and reading from the returnedCMSTypedStream. - The supplied InputStream is not closed automatically. Call
CMSContentInfoParser.close()on this parser (inherited fromCMSContentInfoParser) to close the underlying InputStream, or close it yourself.
-
Field Summary
Fields inherited from class CMSContentInfoParser
_contentInfo, _data -
Constructor Summary
ConstructorsConstructorDescriptionCMSCompressedDataParser(byte[] compressedData) CMSCompressedDataParser(InputStream compressedData) -
Method Summary
Modifier and TypeMethodDescriptiongetContent(InputExpanderProvider expanderProvider) Return a typed stream which will allow the reading of the compressed content in expanded form.Methods inherited from class CMSContentInfoParser
close, isBEREncoded
-
Constructor Details
-
CMSCompressedDataParser
- Throws:
CMSException
-
CMSCompressedDataParser
- Throws:
CMSException
-
-
Method Details
-
getContent
Return a typed stream which will allow the reading of the compressed content in expanded form.- Parameters:
expanderProvider- a provider of expander algorithm implementations.- Returns:
- a type stream which will yield the un-compressed content.
- Throws:
CMSException- if there is an exception parsing the CompressedData object.
-