package com.nari.common.utils;
/**
* @ClassName FileTypeUtil
* @Description 文件类型判断工具类
* @Author
* @Date 2020/5/25 17:43
* @Version 1.0
*/
public class FileTypeUtil {
/**
* 图片格式判断
* @param perfix 后缀
* @return
*/
public static boolean imageType(String perfix) {
if(perfix.equalsIgnoreCase("JPG") || perfix.equalsIgnoreCase("JPEG") || perfix.equalsIgnoreCase("GIF")
|| perfix.equalsIgnoreCase("PNG") || perfix.equalsIgnoreCase("BMP") || perfix.equalsIgnoreCase("PCX")
|| perfix.equalsIgnoreCase("TGA") || perfix.equalsIgnoreCase("PSD") || perfix.equalsIgnoreCase("TIFF"))
return true;
else
return false;
}
/**
* 音频格式判断
* @param perfix 后缀
* @return
*/
public static boolean audioType(String perfix) {
if(perfix.equalsIgnoreCase("mp3") || perfix.equalsIgnoreCase("OGG") || perfix.equalsIgnoreCase("WAV")
|| perfix.equalsIgnoreCase("REAL") || perfix.equalsIgnoreCase("APE") || perfix.equalsIgnoreCase("MODULE")
|| perfix.equalsIgnoreCase("MIDI") || perfix.equalsIgnoreCase("VQF") || perfix.equalsIgnoreCase("CD")) {
return true;
}else {
return false;
}
}
/**
* 视频格式判断
* @param perfix 后缀
* @return
*/
public static boolean videoType(String perfix) {
if(perfix.equalsIgnoreCase("mp4") || perfix.equalsIgnoreCase("avi") || perfix.equalsIgnoreCase("MPEG-1")
|| perfix.equalsIgnoreCase("RM") || perfix.equalsIgnoreCase("ASF") || perfix.equalsIgnoreCase("WMV")
|| perfix.equalsIgnoreCase("qlv") || perfix.equalsIgnoreCase("MPEG-2") || perfix.equalsIgnoreCase("MPEG4")
|| perfix.equalsIgnoreCase("mov") || perfix.equalsIgnoreCase("3gp"))
return true;
else
return false;
}
/**
* 文档格式判断
* @param perfix 后缀
* @return
*/
public static boolean fileType(String perfix){
if(perfix.equalsIgnoreCase("txt") || perfix.equalsIgnoreCase("doc") || perfix.equalsIgnoreCase("docx")
|| perfix.equalsIgnoreCase("pdf") || perfix.equalsIgnoreCase("wps") || perfix.equalsIgnoreCase("rtf")
|| perfix.equalsIgnoreCase("pptx") || perfix.equalsIgnoreCase("ppt")
|| perfix.equalsIgnoreCase("xls") || perfix.equalsIgnoreCase("xlsx"))
return true;
else
return false;
}
}
文件类型判断工具类
最新推荐文章于 2024-09-28 07:46:40 发布