Package kilim.http

Class MimeTypes


  • public class MimeTypes
    extends java.lang.Object
    mime types to simplify building http servers. this class is for convenience and doesn't attempt to be canonical
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.HashMap<java.lang.String,​java.lang.String> mimeTypes  
    • Constructor Summary

      Constructors 
      Constructor Description
      MimeTypes()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.HashMap<java.lang.String,​java.lang.String> cloneMap()  
      static java.lang.String mimeType​(java.io.File file)
      get the mime type of a file based on it's filename extension
      static java.lang.String mimeType​(java.lang.String name)
      get the mime type of a filename based on it's extension
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mimeTypes

        private static java.util.HashMap<java.lang.String,​java.lang.String> mimeTypes
    • Constructor Detail

      • MimeTypes

        public MimeTypes()
    • Method Detail

      • mimeType

        public static java.lang.String mimeType​(java.io.File file)
        get the mime type of a file based on it's filename extension
        Parameters:
        file - a file
        Returns:
        the mime type, or text/plain if not found
      • mimeType

        public static java.lang.String mimeType​(java.lang.String name)
        get the mime type of a filename based on it's extension
        Parameters:
        name - the name of a file
        Returns:
        the mime type, or text/plain if not found
      • cloneMap

        public static java.util.HashMap<java.lang.String,​java.lang.String> cloneMap()