Helius
2020-12-24 7cb29b032e5b607bc37495f2f25ad05264b80f6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.matrix.component.ueditor.define;
 
import java.util.HashMap;
import java.util.Map;
 
public class FileType {
 
    public static final String JPG = "JPG";
    
    private static final Map<String, String> types = new HashMap<String, String>(){{
        
        put( FileType.JPG, ".jpg" );
        
    }};
    
    public static String getSuffix ( String key ) {
        return FileType.types.get( key );
    }
    
    /**
     * 根据给定的文件名,获取其后缀信息
     * @param filename
     * @return
     */
    public static String getSuffixByFilename ( String filename ) {
        
        return filename.substring( filename.lastIndexOf( "." ) ).toLowerCase();
        
    }
    
}