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 ));
|
}
|
}
|