Class MimeTypeUtil
java.lang.Object
ch.tocco.nice2.toolbox.api.mime.MimeTypeUtil
Helper for mime type and file extension evaluation.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetFileExtension(String mimeType) Returns the typical file extension for the given mime type.static StringgetMimeType(BufferedInputStream inputStream, String filename) Returns the most specific mime type for the givenBufferedInputStream.static StringgetMimeType(File file, String filename) Returns the most specific mime type for the givenFile.static org.apache.tika.config.TikaConfig
-
Field Details
-
MIME_TYPE_OCTET_STREAM
-
-
Method Details
-
getMimeType
-
getMimeType
public static String getMimeType(BufferedInputStream inputStream, String filename) throws IOException Returns the most specific mime type for the givenBufferedInputStream.- Parameters:
inputStream- the input stream to inspect for its mimetype.- Returns:
- the most specific mime type.
- Throws:
IOException
-
getFileExtension
Returns the typical file extension for the given mime type.- Parameters:
mimeType- the mime type for which to return the corresponding file extension.- Returns:
- the file extension or empty string, if the mime type does not have a typical file extension.
-
loadTikaConfig
public static org.apache.tika.config.TikaConfig loadTikaConfig()
-