Search in sources :

Example 6 with DigestingParser

use of org.apache.tika.parser.DigestingParser in project tika by apache.

the class TikaGUI method main.

/**
     * Main method. Sets the Swing look and feel to the operating system
     * settings, and starts the Tika GUI with an {@link AutoDetectParser}
     * instance as the default parser.
     *
     * @param args ignored
     * @throws Exception if an error occurs
     */
public static void main(String[] args) throws Exception {
    TikaConfig config = TikaConfig.getDefaultConfig();
    if (args.length > 0) {
        File configFile = new File(args[0]);
        config = new TikaConfig(configFile);
    }
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    final TikaConfig finalConfig = config;
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            new TikaGUI(new DigestingParser(new AutoDetectParser(finalConfig), new CommonsDigester(MAX_MARK, CommonsDigester.DigestAlgorithm.MD5, CommonsDigester.DigestAlgorithm.SHA256))).setVisible(true);
        }
    });
}
Also used : TikaConfig(org.apache.tika.config.TikaConfig) CommonsDigester(org.apache.tika.parser.utils.CommonsDigester) AutoDetectParser(org.apache.tika.parser.AutoDetectParser) DigestingParser(org.apache.tika.parser.DigestingParser) File(java.io.File)

Aggregations

DigestingParser (org.apache.tika.parser.DigestingParser)6 AutoDetectParser (org.apache.tika.parser.AutoDetectParser)4 File (java.io.File)3 Metadata (org.apache.tika.metadata.Metadata)3 Parser (org.apache.tika.parser.Parser)3 InputStream (java.io.InputStream)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 TikaConfig (org.apache.tika.config.TikaConfig)2 ParseContext (org.apache.tika.parser.ParseContext)2 CommonsDigester (org.apache.tika.parser.utils.CommonsDigester)2 BodyContentHandler (org.apache.tika.sax.BodyContentHandler)2 RichTextContentHandler (org.apache.tika.sax.RichTextContentHandler)2 ContentHandler (org.xml.sax.ContentHandler)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileInputStream (java.io.FileInputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 URI (java.net.URI)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1