How to get file extension for type Mime (content type)

There are many ways to get the Mime type from a given InputStream or File. But considering MimeType or (in terms of HTTP: content type), how do I get a list of file extensions.

The Java activation library has a MimetypesFileTypeMap, but there is an Ext → Mime Type file. I need Mime Type -> File Ext.

It seems like I would have to copy the pseudo-private code that is in com.sun.activation to load mime type mappings.

+3
source share
2 answers

Java Mimeutil, mime-types.properties , .

0

Apache mime.types. . Apache Group/Apache2/conf.

0

Source: https://habr.com/ru/post/1780890/


All Articles