I'm using Apache Tika, and I have files (without extension) of particular content type that need to be renamed to have extension that reflect the content type.
Any idea if there is something I could use instead of programming that from scratch based on content type names ?
You want to look at file tika-mimetypes.xml -> check out tika's source code and :
org.apache.tika.mime.MimeTypesReader
} else if (nodeElement.getTagName().equals(GLOB_TAG)) {
boolean useRegex = Boolean.valueOf(nodeElement.getAttribute(ISREGEX_ATTR));
types.addPattern(type, nodeElement.getAttribute(PATTERN_ATTR), useRegex);
You can then work wit
org.apache.tika.mime.MimeTypes
private Patterns patterns = new Patterns(registry);