Get Tika Metadata
Extract metadata from a file using Apache Tika.
Javadoc available at https://www.javatapas.com/docs/javatapas/tika/GetTikaMetadata.html
public void getTikaMetadata(File inFile) throws IOException, FileNotFoundException {
Parser parser = new AutoDetectParser();
InputStream stream = new FileInputStream(inFile);
Metadata metadata = new Metadata();
ParseContext context = new ParseContext();
context.set(Parser.class, parser);
Reader reader = new ParsingReader(parser, stream, metadata, context);
for (String name: metadata.names()){
System.out.println("Tika Key: " + name + " Tika Value: " + metadata.getValues(name));
}
stream.close();
reader.close();
}