Class MimeTypeHelper
- java.lang.Object
-
- org.hippoecm.frontend.editor.plugins.resource.MimeTypeHelper
-
public class MimeTypeHelper extends Object
- Since:
- 2015-01-28
- Version:
- $Id$
- Author:
- cngo
-
-
Field Summary
Fields Modifier and Type Field Description static String
MIME_APPLICATION_POSTSCRIPT
static String
MIME_TYPE_CITRIX_GIF
static String
MIME_TYPE_CITRIX_JPEG
static String
MIME_TYPE_GIF
static String
MIME_TYPE_JPEG
static String
MIME_TYPE_PDF
static String
MIME_TYPE_PJPEG
static String
MIME_TYPE_PNG
static String
MIME_TYPE_SVG
static String
MIME_TYPE_X_PNG
static String
MIME_TYPE_XML
static String
MIMETYPE_IMAGE_PREFIX
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static 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 Detail
-
MIME_TYPE_JPEG
public static final String MIME_TYPE_JPEG
- See Also:
- Constant Field Values
-
MIME_TYPE_PJPEG
public static final String MIME_TYPE_PJPEG
- See Also:
- Constant Field Values
-
MIME_TYPE_CITRIX_JPEG
public static final String MIME_TYPE_CITRIX_JPEG
- See Also:
- Constant Field Values
-
MIME_TYPE_GIF
public static final String MIME_TYPE_GIF
- See Also:
- Constant Field Values
-
MIME_TYPE_CITRIX_GIF
public static final String MIME_TYPE_CITRIX_GIF
- See Also:
- Constant Field Values
-
MIME_TYPE_PNG
public static final String MIME_TYPE_PNG
- See Also:
- Constant Field Values
-
MIME_TYPE_X_PNG
public static final String MIME_TYPE_X_PNG
- See Also:
- Constant Field Values
-
MIME_TYPE_PDF
public static final String MIME_TYPE_PDF
- See Also:
- Constant Field Values
-
MIME_TYPE_SVG
public static final String MIME_TYPE_SVG
- See Also:
- Constant Field Values
-
MIME_TYPE_XML
public static final String MIME_TYPE_XML
- See Also:
- Constant Field Values
-
MIME_APPLICATION_POSTSCRIPT
public static final String MIME_APPLICATION_POSTSCRIPT
- See Also:
- Constant Field Values
-
MIMETYPE_IMAGE_PREFIX
public static final String MIMETYPE_IMAGE_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
sanitizeMimeType
public static String sanitizeMimeType(String mimeType)
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
public static boolean isImageMimeType(String mimeType)
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
public static boolean isSvgMimeType(String mimeType)
-
isPdfMimeType
public static boolean isPdfMimeType(String mimeType)
-
isJpegMimeType
public static boolean isJpegMimeType(String mimeType)
-
-