public TrecDocument summarize(File file) throws FileNotFoundException, IOException, TikaException {
        Tika tika = new Tika();
        Metadata met = new Metadata();

        String contents = tika.parseToString(new FileInputStream(file), met);
        return new TrecDocument(met.get(TikaCoreProperties.RESOURCE_NAME_KEY), contents, met.getDate(TikaCoreProperties.CREATED));

    }
Generates document summaries for corpus analysis in the Open Relevance
project.
tika-example/src/main/java/org/apache/tika/example/TrecDocumentGenerator.java