public static void main(String[] args) {
File file = new File("/192.168.51.160/test/copy/a/base.avi");
if (file.exists()) {
File temp = new File("/192.168.51.160/test/copy/a/base.avi_temp");
if (file.renameTo(temp)) {
System.out.println("重命名成功!");
}
if (temp.exists()) {
System.out.println(temp.getName()+"存在!");
try {
//RandomAccessFile Rand = new RandomAccessFile(file, "rw");
RandomAccessFile Rand = new RandomAccessFile(temp, "rw");
Rand.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
控制台打印出以下信息重命名成功!
base.avi_temp存在!然后就报出FileNotFoundException异常java.io.FileNotFoundException: /192.168.51.160/test/copy/a/base.avi_temp (Input/output error)可我的文件都是存在的。当我把base.avi_temp 改之前的文件名base.avi时此文件就打不开了。会不会因为该文件损坏导致了java.io.FileNotFoundException: /192.168.51.160/test/copy/a/base.avi_temp (Input/output error)这个异常
如果是文件损坏,它为什么会损坏?我只是重命名了一下啊!还有我特变想知道(Input/output error) 具体指的是什么
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货