Details
-
Wish
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
1.3
-
None
-
None
Description
When using mime type detection, the classes allow following use:
try (InputStream is = theInputStream;
BufferedInputStream bis = new BufferedInputStream(is)
When debugging this, the MimeTypes class instantiates its internal patterns with an empty MediaTypeRegistry. Therefore, getDefaultMimeTypes() is never called and thus tika-mimetypes.xml never read.
Is it possible to enable direct usage of MediaType.detect()? Like adding a new constructor, where the MediaTypeRegistry can be set?
If not, the code comments (or the documentation at https://tika.apache.org/0.10/detection.html) should point out that MimeTypes() should not instantiated directly for mime type detection, but the detectors should be used. Possibly, a minimum example should be added to make the usage clear.
Following example works here
try (InputStream is = theInputStream;
BufferedInputStream bis = new BufferedInputStream(is)