public void copyFile(string oldPath,String newPath) {
try {
int bytesum = 0;
int byteread - 0;
File oldfile = new File(oldPath);
if (oldfile.exists0) {//文件存在时
Inputstream instream = new FileInputstream(oldPath);//读入原文件
FileOutputstream fs = new FileOutputstream(newPath);
byte[] buffer = new byte[1444];
int length;
while ( (byteread = inStream.read(buffer)) l= -1) {
bytesum += byteread; //字节数文件大小
System.out.println(bytesum);
fs.write(buffer,o,byteread);
}
instream.close();
}
}
catch (Exception e) {
system.out.println(""复制单个文件操作出错"");
e.printstackTrace();
}
}