Tika Autodetect Parser

Posted on by Kim

final InputStream is = new ByteArrayInputStream(binary);
Metadata md = new MetaData();
// Need to add filename to metadata, since office docs header elements are ambiguous and Tika determines the exact minetype by looking at the file extension
md.add(Metadata.RESOURCE_NAME_KEY, filename);
String mimetype = new DefaultDetector(MimeTypes.getDefaultMimeTypes()).detect(is, md).toString();

0 Responses to "Tika Autodetect Parser":