Class MimeTypeHelper
java.lang.Object
org.hippoecm.frontend.editor.plugins.resource.MimeTypeHelper
- Since:
- 2015-01-28
- Version:
- $Id$
- Author:
- cngo
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isImageMimeType
(String mimeType) Checks whether the given MIME type indicates an image.static boolean
isJpegMimeType
(String mimeType) static boolean
isPdfMimeType
(String mimeType) static boolean
isSvgMimeType
(String mimeType) static String
sanitizeMimeType
(String mimeType) Mimetypes can be a tricky thing as browsers and/or environments tend to alter them without good reason.static void
validateMimeType
(InputStream inputStream, String mimeType) Deprecated.Not used any more, deprecated since 14.7.0, will be dropped in next major
-
Field Details
-
MIME_TYPE_JPEG
- See Also:
-
MIME_TYPE_PJPEG
- See Also:
-
MIME_TYPE_CITRIX_JPEG
- See Also:
-
MIME_TYPE_GIF
- See Also:
-
MIME_TYPE_CITRIX_GIF
- See Also:
-
MIME_TYPE_PNG
- See Also:
-
MIME_TYPE_X_PNG
- See Also:
-
MIME_TYPE_PDF
- See Also:
-
MIME_TYPE_SVG
- See Also:
-
MIME_TYPE_XML
- See Also:
-
MIME_APPLICATION_POSTSCRIPT
- See Also:
-
MIMETYPE_IMAGE_PREFIX
- See Also:
-
-
Method Details
-
sanitizeMimeType
Mimetypes can be a tricky thing as browsers and/or environments tend to alter them without good reason. This method will try to fix any of the quirks concerning mimetypes that are found out there.- Parameters:
mimeType
- The mimetype that needs to be sanitized.- Returns:
- A standard compliant mimetype in lowercase
-
validateMimeType
@Deprecated public static void validateMimeType(InputStream inputStream, String mimeType) throws InvalidMimeTypeException Deprecated.Not used any more, deprecated since 14.7.0, will be dropped in next majorValidate if the given datainputStream
has the expected mime type identified bymimeType
. Exception will throw if the MimeType is invalid- Parameters:
inputStream
-mimeType
-- Throws:
ResourceException
InvalidMimeTypeException
-
isImageMimeType
Checks whether the given MIME type indicates an image.- Parameters:
mimeType
- the MIME type to check- Returns:
- true if the given MIME type indicates an image, false otherwise.
-
isSvgMimeType
-
isPdfMimeType
-
isJpegMimeType
-