/**
* 验证文件名是否规范(不包含目录)
* @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();
}
}
由于未提供博客具体内容,无法生成包含关键信息的摘要。
1149

被折叠的 条评论
为什么被折叠?



