您的位置:首页 > 编程语言 > Java开发

JAVA查看服务器文件路径是否存在

2009-09-21 09:17 309 查看
StringBuilder buf = new StringBuilder();
buf.append(headerPath);
buf.append(File.separatorChar);
buf.append(infoBean.getMemberId());
buf.append( File.separatorChar );
buf.append(infoBean.getPicturePath());

//检查磁盘上是否存在相应的图片文件
File imageFile = new File(buf.toString());
boolean isFileExists = imageFile.exists();
if(isFileExists){
returnBean.setPicturePath(infoBean.getPicturePath());
} else {
returnBean.setPicturePath(null);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: