Package io.meeds.appcenter.util
Class ImageTypeUtils
java.lang.Object
io.meeds.appcenter.util.ImageTypeUtils
Decides the type of an image from its first bytes, never from a name or a
label a client sent.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdetectImageMimeType(byte[] content) Decides the type of an image from its content.
-
Field Details
-
PNG_MIME_TYPE
Type of a PNG image.- See Also:
-
JPEG_MIME_TYPE
Type of a JPEG image.- See Also:
-
GIF_MIME_TYPE
Type of a GIF image.- See Also:
-
WEBP_MIME_TYPE
Type of a WebP image.- See Also:
-
-
Method Details
-
detectImageMimeType
Decides the type of an image from its content.- Parameters:
content- the content of a file- Returns:
- the MIME type of a PNG, JPEG, GIF or WebP image, null for any other content, SVG included
-