Class ContentTypeUtils


  • public final class ContentTypeUtils
    extends Object
    Utils for handling content type
    • Method Detail

      • getContentTypeByExtension

        public static Optional<String> getContentTypeByExtension​(String extension)
        Get the content type corresponding to an extension.
        Parameters:
        extension - the extension to search the content type for
        Returns:
        the content type
      • getContentTypeByPath

        public static Optional<String> getContentTypeByPath​(String path)
        Get the content type corresponding to a path.
        Parameters:
        path - the path to search the content type for
        Returns:
        the content type
      • isJsonContentType

        public static boolean isJsonContentType​(String contentType)
        Check if a content type is json
        Parameters:
        contentType - the content type to check
        Returns:
        true if the the given content type is json
      • toJsonFilename

        public static String toJsonFilename​(String filename)
      • setExtension

        public static String setExtension​(String filename,
                                          String extension)
      • removeExtension

        public static String removeExtension​(String filename,
                                             String extension)
      • fullExtension

        public static String fullExtension​(String extension)