Search in sources :

Example 1 with CMSTimeStampedDataParser

use of org.bouncycastle.tsp.cms.CMSTimeStampedDataParser in project tika by apache.

the class TSDParser method parseTSDContent.

private void parseTSDContent(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) {
    CMSTimeStampedDataParser cmsTimeStampedDataParser = null;
    EmbeddedDocumentExtractor edx = EmbeddedDocumentUtil.getEmbeddedDocumentExtractor(context);
    if (edx.shouldParseEmbedded(metadata)) {
        try {
            cmsTimeStampedDataParser = new CMSTimeStampedDataParser(stream);
            try (InputStream is = TikaInputStream.get(cmsTimeStampedDataParser.getContent())) {
                edx.parseEmbedded(is, handler, metadata, false);
            }
        } catch (Exception ex) {
            LOG.error("Error in TSDParser.parseTSDContent {}", ex.getMessage());
        } finally {
            this.closeCMSParser(cmsTimeStampedDataParser);
        }
    }
}
Also used : EmbeddedDocumentExtractor(org.apache.tika.extractor.EmbeddedDocumentExtractor) TikaInputStream(org.apache.tika.io.TikaInputStream) RereadableInputStream(org.apache.tika.utils.RereadableInputStream) InputStream(java.io.InputStream) CMSTimeStampedDataParser(org.bouncycastle.tsp.cms.CMSTimeStampedDataParser) TikaException(org.apache.tika.exception.TikaException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SAXException(org.xml.sax.SAXException) NoSuchProviderException(java.security.NoSuchProviderException)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 NoSuchProviderException (java.security.NoSuchProviderException)1 TikaException (org.apache.tika.exception.TikaException)1 EmbeddedDocumentExtractor (org.apache.tika.extractor.EmbeddedDocumentExtractor)1 TikaInputStream (org.apache.tika.io.TikaInputStream)1 RereadableInputStream (org.apache.tika.utils.RereadableInputStream)1 CMSTimeStampedDataParser (org.bouncycastle.tsp.cms.CMSTimeStampedDataParser)1 SAXException (org.xml.sax.SAXException)1