2021与蓝度共同重构项目,服务端
liuhaonan
2022-10-26 c7be2ef037c5aebb0cd8f1f33e5fa934389e6083
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.sandu.ximon.admin.minio;
 
import com.sandu.ximon.admin.minio.entity.FileSuffix;
 
import java.text.DecimalFormat;
 
public class BroadcastFileUtils {
 
 
    /**
     * 判断后缀名是否一致
     */
    public static boolean isMp3File(String filename, FileSuffix suffix) {
 
        String fileSuffix = filename.substring(filename.lastIndexOf(".")+1);
 
        if(fileSuffix.equals(suffix.getSuffix())) {
            return true;
        }
        return false;
    }
 
    /**
     * 字节数转MB
     * @param size
     * @return
     */
    public static Double getMBSize(long size) {
        return Double.valueOf(new DecimalFormat("#.00").format((size / 1024) /1024 ));
    }
}