Class CryptoParser

  • All Implemented Interfaces:
    java.io.Serializable, Parser

    public abstract class CryptoParser
    extends DelegatingParser
    Decrypts the incoming document stream and delegates further parsing to another parser instance. The decryption key and other settings as well as the delegate parser are taken from the parsing context.
    Since:
    Apache Tika 0.10
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CryptoParser​(java.lang.String transformation, java.security.Provider provider, java.util.Set<MediaType> types)  
      CryptoParser​(java.lang.String transformation, java.util.Set<MediaType> types)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<MediaType> getSupportedTypes​(ParseContext context)
      Returns the set of media types supported by this parser when used with the given parse context.
      void parse​(java.io.InputStream stream, org.xml.sax.ContentHandler handler, Metadata metadata, ParseContext context)
      Looks up the delegate parser from the parsing context and delegates the parse operation to it.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CryptoParser

        public CryptoParser​(java.lang.String transformation,
                            java.security.Provider provider,
                            java.util.Set<MediaType> types)
      • CryptoParser

        public CryptoParser​(java.lang.String transformation,
                            java.util.Set<MediaType> types)
    • Method Detail

      • getSupportedTypes

        public java.util.Set<MediaType> getSupportedTypes​(ParseContext context)
        Description copied from interface: Parser
        Returns the set of media types supported by this parser when used with the given parse context.
        Specified by:
        getSupportedTypes in interface Parser
        Overrides:
        getSupportedTypes in class DelegatingParser
        Parameters:
        context - parse context
        Returns:
        immutable set of media types
      • parse

        public void parse​(java.io.InputStream stream,
                          org.xml.sax.ContentHandler handler,
                          Metadata metadata,
                          ParseContext context)
                   throws java.io.IOException,
                          org.xml.sax.SAXException,
                          TikaException
        Description copied from class: DelegatingParser
        Looks up the delegate parser from the parsing context and delegates the parse operation to it. If a delegate parser is not found, then an empty XHTML document is returned.

        Subclasses should override this method to parse the top level structure of the given document stream. Parsed sub-streams can be passed to this base class method to be parsed by the configured delegate parser.

        Specified by:
        parse in interface Parser
        Overrides:
        parse in class DelegatingParser
        Parameters:
        stream - the document stream (input)
        handler - handler for the XHTML SAX events (output)
        metadata - document metadata (input and output)
        context - parse context
        Throws:
        java.io.IOException - if the document stream could not be read
        org.xml.sax.SAXException - if the SAX events could not be processed
        TikaException - if the document could not be parsed