【文件属性】:
文件名称:fileutil工具类 处理文件流工具
文件大小:4KB
文件格式:JAVA
更新时间:2022-04-19 03:55:51
java file
fileutil工具类 处理文件流工具
private static File file;
/**
* 判断文件是否存在
*
* @param path
* 文件路径
* @return boolean
*/
public static boolean fileIsExists(String path) {
if (path == null)
return false;
file = new File(path);
return file.exists();
}
/**
* 判断服务器文件是否存在
*
* @param path
* 文件路径
* @param request
* HttpServletRequest
* @return boolean
*/
public static boolean fileIsExists(String path, HttpServletRequest request) {
if (path == null)
return false;
file = new File(request.getServletContext().getRealPath(path));
return file.exists();
}