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 Details

  • Method Details

    • 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 major
      Validate if the given data inputStream has the expected mime type identified by mimeType. 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)