public static String getExtension(MimeType mime) {

            String ext = mime.getExtension();
            if (ext.startsWith(".")) {
                ext = ext.substring(1);
            }

            //special handling for text/html/xml
            if (ext.isEmpty()) {
                ext = tryTextyTypes(mime.getType());
            }
            return ext;
        }
Utility method to convert from a string value representing a content type
(e.g. "application/pdf") into the most common extension for that file type
(e.g. "pdf").
<p>
This will has special handling for texty filetypes whose MimeTypes
don't currently return anything for {@link MimeType#getExtension};

@param contentType string representing a content type, for example: "application/pdf"
@param config      config from which to get MimeRepository
@return extension or empty string
@throws MimeTypeException thrown if MimeTypes can't parse the contentType
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/db/MimeBuffer.java