Package org.apache.tika.detect

Examples of org.apache.tika.detect.DefaultDetector


    private boolean prettyPrint;
   
    public TikaCLI() throws Exception {
        context = new ParseContext();
        detector = new DefaultDetector();
        parser = new AutoDetectParser(detector);
        context.set(Parser.class, parser);
        context.set(PasswordProvider.class, new PasswordProvider() {
            public String getPassword(Metadata metadata) {
                return password;
View Full Code Here


     * Creates a Tika facade using the given configuration.
     *
     * @param config Tika configuration
     */
    public Tika(TikaConfig config) {
        this(new DefaultDetector(config.getMimeRepository()),
                new AutoDetectParser(config));
    }
View Full Code Here

     *
     * @param detector Detector to use
     * @param parsers
     */
    public AutoDetectParser(Parser...parsers) {
        this(new DefaultDetector(), parsers);
    }
View Full Code Here

        setDetector(detector);
    }

    public AutoDetectParser(TikaConfig config) {
        super(config.getMediaTypeRegistry(), config.getParser());
        setDetector(new DefaultDetector(config.getMimeRepository()));
    }
View Full Code Here

    /**
     * @deprecated This method will be removed in Tika 1.0
     */
    public void setConfig(TikaConfig config) {
        setParsers(config.getParsers());
        setDetector(new DefaultDetector(config.getMimeRepository()));
        setMediaTypeRegistry(config.getMediaTypeRegistry());
    }
View Full Code Here

    public FileSystemContentReader() {
    }

    @PostConstruct
    public void initialise() {
        detector = new DefaultDetector();
        defaultDir = configurationService.getHome()+File.separator+"resources";

        log.debug("FileSystem Content Reader started (default directory: {})",defaultDir);

    }
View Full Code Here

    public FileSystemContentReader() {
    }

    @PostConstruct
    public void initialise() {
        detector = new DefaultDetector();
        defaultDir = configurationService.getHome()+File.separator+"resources";

        log.debug("FileSystem Content Reader started (default directory: {})",defaultDir);

    }
View Full Code Here

    private boolean prettyPrint;
   
    public TikaCLI() throws Exception {
        context = new ParseContext();
        detector = new DefaultDetector();
        parser = new AutoDetectParser(detector);
        context.set(Parser.class, parser);
        context.set(PasswordProvider.class, new PasswordProvider() {
            public String getPassword(Metadata metadata) {
                return password;
View Full Code Here

     * We don't currently support the .xlsb file format
     *  (an OOXML container with binary blobs), but we
     *  shouldn't break on these files either (TIKA-826
     */
    public void testExcelXLSB() throws Exception {
       Detector detector = new DefaultDetector();
       AutoDetectParser parser = new AutoDetectParser();
      
       InputStream input = ExcelParserTest.class.getResourceAsStream(
             "/test-documents/testEXCEL.xlsb");
       Metadata m = new Metadata();
       m.add(Metadata.RESOURCE_NAME_KEY, "excel.xlsb");
      
       // Should be detected correctly
       MediaType type = null;
       try {
          type = detector.detect(input, m);
          assertEquals("application/vnd.ms-excel.sheet.binary.macroenabled.12", type.toString());
       } finally {
          input.close();
       }
      
View Full Code Here

        }
       
        if (inputStreams.size() > 0) {
          MimeTypes mimeTypes = MimeTypesFactory.create(inputStreams.toArray(new InputStream[inputStreams.size()]));
          ServiceLoader loader = new ServiceLoader();
          this.detector = new DefaultDetector(mimeTypes, loader);
        } else {
          throw new MorphlineCompilationException("Missing specification for MIME type mappings", config);
        }     
      } finally {
        for (InputStream in : inputStreams) {
View Full Code Here

TOP

Related Classes of org.apache.tika.detect.DefaultDetector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.