/**
* 验证文件名是否规范(不包含目录)
* @author hsj
* @param fileName
* @return
*/
public static boolean isValidFileName(String fileName) {
if (fileName == null || fileName.length() > 255) {
return false;
}else {
// 空格换行 \ / : * ? " < >
Pattern pattern = Pattern.compile("\\s|\\\\|/|:|\\*|\\?|\\\"|<|>|[|]|\\|");
Matcher matcher = pattern.matcher(fileName);
return !matcher.find();
}
}