use of com.github.zhenwei.pkix.util.asn1.cms.CompressedDataParser in project LinLong-Java by zhenwei1108.
the class CMSCompressedDataParser method getContent.
/**
* Return a typed stream which will allow the reading of the compressed content in expanded form.
*
* @param expanderProvider a provider of expander algorithm implementations.
* @return a type stream which will yield the un-compressed content.
* @throws CMSException if there is an exception parsing the CompressedData object.
*/
public CMSTypedStream getContent(InputExpanderProvider expanderProvider) throws CMSException {
try {
CompressedDataParser comData = new CompressedDataParser((ASN1SequenceParser) _contentInfo.getContent(BERTags.SEQUENCE));
ContentInfoParser content = comData.getEncapContentInfo();
InputExpander expander = expanderProvider.get(comData.getCompressionAlgorithmIdentifier());
ASN1OctetStringParser bytes = (ASN1OctetStringParser) content.getContent(BERTags.OCTET_STRING);
return new CMSTypedStream(content.getContentType(), expander.getInputStream(bytes.getOctetStream()));
} catch (IOException e) {
throw new CMSException("IOException reading compressed content.", e);
}
}
Aggregations