感谢水木forevery提供的方法:
方法1.根据返回值判断是否能创建文件方法2.正则表达式fileName.matches("[^/\\\\<>*?|\"]&#43;")
转:https://www.cnblogs.com/iceface/p/3288814.html