春风项目四线(合箱线、总装线)
yyt
2024-02-17 f7a99591d83efd59af37b257e30d12f10291f4ef
提交 | 用户 | 时间
fd2207 1 package com.jcdm.common.utils.file;
2
3 /**
4  * 媒体类型工具类
5  * 
6  * @author jc
7  */
8 public class MimeTypeUtils
9 {
10     public static final String IMAGE_PNG = "image/png";
11
12     public static final String IMAGE_JPG = "image/jpg";
13
14     public static final String IMAGE_JPEG = "image/jpeg";
15
16     public static final String IMAGE_BMP = "image/bmp";
17
18     public static final String IMAGE_GIF = "image/gif";
19     
20     public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
21
22     public static final String[] FLASH_EXTENSION = { "swf", "flv" };
23
24     public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
25             "asf", "rm", "rmvb" };
26
27     public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" };
28
29     public static final String[] DEFAULT_ALLOWED_EXTENSION = {
30             // 图片
31             "bmp", "gif", "jpg", "jpeg", "png",
32             // word excel powerpoint
33             "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
34             // 压缩文件
35             "rar", "zip", "gz", "bz2",
36             // 视频格式
37             "mp4", "avi", "rmvb",
38             // pdf
39             "pdf" };
40
41     public static String getExtension(String prefix)
42     {
43         switch (prefix)
44         {
45             case IMAGE_PNG:
46                 return "png";
47             case IMAGE_JPG:
48                 return "jpg";
49             case IMAGE_JPEG:
50                 return "jpeg";
51             case IMAGE_BMP:
52                 return "bmp";
53             case IMAGE_GIF:
54                 return "gif";
55             default:
56                 return "";
57         }
58     }
59 }