Package org.apache.tika

Examples of org.apache.tika.Tika


    }
   
    public void listMetadata(String fileName) {
        try {
            File f = new File(fileName);
            Tika tika = new Tika();    
            String mimeType = tika.detect(f);
            LOG.info("Detected MIME type: "+ mimeType);
           
            // extract metadata: first get a parser
            MetadataParser parser = CFG.getParser(mimeType);
            if (null == parser) {
View Full Code Here


      config = TikaConfig.getDefaultConfig();
    } catch (Exception e) {
      throw new RuntimeException("Error while loading Tika configuration.", e);
    }
    types = config.getMimeRepository();
    tika = new Tika(config);
  }
View Full Code Here

      inputStream.close();
    } catch (Exception e) {
      throw new RuntimeException("Error while loading Tika configuration.", e);
    }
    types = config.getMimeRepository();
    tika = new Tika(config);
  }
View Full Code Here

        if (types == null) {
            types = config.getMimeRepository();
        }

        if(tika == null) {
            tika = new Tika(config);
        }
    }
View Full Code Here

        ignoreOutsideDomain = ConfUtils.getBoolean(conf,
                "parser.ignore.outlinks.outside.domain", false);

        // instanciate Tika
        long start = System.currentTimeMillis();
        tika = new Tika();
        long end = System.currentTimeMillis();

        LOG.debug("Tika loaded in " + (end - start) + " msec");

        this.collector = collector;
View Full Code Here

    }

    public static String getMimeTypeWithByteBuffer(java.nio.ByteBuffer buffer) throws IOException {
        byte[] b = buffer.array();

        Tika tika = new Tika();
        return tika.detect(b);
    }
View Full Code Here

    }

    public static String getMimeTypeWithByteBuffer(java.nio.ByteBuffer buffer) throws IOException {
        byte[] b = buffer.array();

        Tika tika = new Tika();
        return tika.detect(b);
    }
View Full Code Here

      if (pathEntries.isEmpty()) {
        // requested a specific resource
        String file = StringUtils.getLastPathElement(requestedPath);
        try {
          // query Tika for the content type
          Tika tika = new Tika();
          String contentType = tika.detect(file);

          if (contentType == null) {
            // ask the container for the content type
            contentType = context.getMimeType(requestedPath);
View Full Code Here

                    } else if (path.endsWith(".jpeg")) {
                        mimetype = "image/jpeg";
                    } else if (path.endsWith(".gif")) {
                        mimetype = "image/gif";
                    } else {
                        mimetype = new Tika().detect(result);
                    }
                }
                if (request.getHeader("If-None-Match:") != null) {
                    // client should always use cached version
                    log.info("sending 304");
View Full Code Here

                    File file = new File(attach);
                    input = new BufferedInputStream(new FileInputStream(file));
                    System.err.println("Attaching: " + file.getCanonicalPath());
                }
                attachment = Common.readFully(input);
                mimetype = new Tika().detect(attachment);
                System.err.println("Detected type: " + mimetype);
            } catch (Throwable t) {
                log.error("Could not read attachment: " + attach, t);
                return 73; // "can't create output error"
            } finally {
View Full Code Here

TOP

Related Classes of org.apache.tika.Tika

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.