Class TikaOfficeDetectParser

  • All Implemented Interfaces:
    Serializable, org.apache.tika.parser.Parser

    public class TikaOfficeDetectParser
    extends Object
    implements org.apache.tika.parser.Parser
    Apache Tika assumes that you either know exactly what your content is, or that you'll leave it to auto-detection. Within Alfresco, we usually do know. However, from time to time, we don't know if we have one of the old or one of the new office files (eg .xls and .xlsx). This class allows automatically selects the appropriate old (OLE2) or new (OOXML) Tika parser as required.
    Author:
    Nick Burch
    See Also:
    Serialized Form
    • Constructor Detail

      • TikaOfficeDetectParser

        public TikaOfficeDetectParser()
    • Method Detail

      • getSupportedTypes

        public Set<org.apache.tika.mime.MediaType> getSupportedTypes​(org.apache.tika.parser.ParseContext parseContext)
        Specified by:
        getSupportedTypes in interface org.apache.tika.parser.Parser
      • parse

        public void parse​(InputStream stream,
                          ContentHandler handler,
                          org.apache.tika.metadata.Metadata metadata,
                          org.apache.tika.parser.ParseContext parseContext)
                   throws IOException,
                          SAXException,
                          org.apache.tika.exception.TikaException
        Specified by:
        parse in interface org.apache.tika.parser.Parser
        Throws:
        IOException
        SAXException
        org.apache.tika.exception.TikaException