public class FileUtil {
private static final Map<String, String> typeMap = new HashMap<>();
static {
typeMap.put(".3gp", "video/3gpp");
typeMap.put(".apk", "application/vnd.android.package-archive");
typeMap.put(".asf", "video/x-ms-asf");
typeMap.put(".avi", "video/x-msvideo");
typeMap.put(".bin", "application/octet-stream");
typeMap.put(".bmp", "image/bmp");
typeMap.put(".c", "text/plain");
typeMap.put(".class", "application/octet-stream");
typeMap.put(".conf", "text/plain");
typeMap.put(".cpp", "text/plain");
typeMap.put(".doc", "application/msword");
typeMap.put(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
typeMap.put(".xls", "application/vnd.ms-excel");
typeMap.put(".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
typeMap.put(".exe", "application/octet-stream");
typeMap.put(".gif", "image/gif");
typeMap.put(".gtar", "application/x-gtar");
typeMap.put(".gz", "application/x-gzip");
typeMap.put(".h", "text/plain");
typeMap.put(".htm", "text/html");
typeMap.put(".html", "text/html");
typeMap.put(".jar", "application/java-archive");
typeMap.put(".java", "text/plain");
typeMap.put(".jpeg", "image/jpeg");
typeMap.put(".jpg", "image/jpeg");
typeMap.put(".js", "application/x-javascript");
typeMap.put(".log", "text/plain");
typeMap.put(".m3u", "audio/x-mpegurl");
typeMap.put(".m4a", "audio/mp4a-latm");
typeMap.put(".m4b", "audio/mp4a-latm");
typeMap.put(".m4p", "audio/mp4a-latm");
typeMap.put(".m4u", "video/vnd.mpegurl");
typeMap.put(".m4v", "video/x-m4v");
typeMap.put(".mov", "video/quicktime");
typeMap.put(".mp2", "audio/x-mpeg");
typeMap.put(".mp3", "audio/x-mpeg");
typeMap.put(".mp4", "video/mp4");
typeMap.put(".mpc", "application/vnd.mpohun.certificate");
typeMap.put(".mpe", "video/mpeg");
typeMap.put(".mpeg", "video/mpeg");
typeMap.put(".mpg", "video/mpeg");
typeMap.put(".mpg4", "video/mp4");
typeMap.put(".mpga", "audio/mpeg");
typeMap.put(".msg", "application/vnd.ms-outlook");
typeMap.put(".ogg", "audio/ogg");
typeMap.put(".pdf", "application/pdf");
typeMap.put(".png", "image/png");
typeMap.put(".pps", "application/vnd.ms-powerpoint");
typeMap.put(".ppt", "application/vnd.ms-powerpoint");
typeMap.put(".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
typeMap.put(".prop", "text/plain");
typeMap.put(".rc", "text/plain");
typeMap.put(".rmvb", "audio/x-pn-realaudio");
typeMap.put(".rtf", "application/rtf");
typeMap.put(".sh", "text/plain");
typeMap.put(".tar", "application/x-tar");
typeMap.put(".tgz", "application/x-compressed");
typeMap.put(".txt", "text/plain");
typeMap.put(".wav", "audio/x-wav");
typeMap.put(".wma", "audio/x-ms-wma");
typeMap.put(".wmv", "audio/x-ms-wmv");
typeMap.put(".wps", "application/vnd.ms-works");
typeMap.put(".xml", "text/plain");
typeMap.put(".z", "application/x-compress");
typeMap.put(".zip", "application/x-zip-compressed");
typeMap.put("", "*/*");
}
}