验证文件后缀 @param fileName 文件名称(含后缀) @param formatList 允许格式列表
(String fileName,List<String> formatList)
| 249 | * @param formatList 允许格式列表 |
| 250 | */ |
| 251 | public static boolean validateFileSuffix(String fileName,List<String> formatList){ |
| 252 | //取得文件后缀 |
| 253 | String suffix = getExtension(fileName); |
| 254 | for(String format : formatList) { |
| 255 | String[] fileType_array = format.split("/"); |
| 256 | for(String fileType : fileType_array){ |
| 257 | if(fileType.equalsIgnoreCase(suffix)){ |
| 258 | return true; |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | } |
| 263 | |
| 264 | return false; |
| 265 | } |
| 266 | /** |
| 267 | * 获取文件后缀名 |
| 268 | * @param path 路径 |
no test coverage detected