import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyFile {
public static void main(String[] args) {
long s = System.currentTimeMillis();
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("e:\\e.exe");
fos = new FileOutputStream("d:\\e.exe");
int len = 0;
byte[] bytes = new byte[1024];
while ((len = fis.read(bytes)) != -1) {
fos.write(bytes, 0, len);
}
} catch (IOException e) {
e.getMessage();
throw new RuntimeException("文件复制失败");
} finally {
try {
if (fis != null)
fis.close();
} catch (IOException e) {
throw new RuntimeException("释放资源失败");
} finally {
try {
if (fos != null)
fos.close();
} catch (IOException e) {
throw new RuntimeException("释放资源失败");
}
}
}
long e = System.currentTimeMillis();
System.out.println(e-s);
}
}