import java.io.*;public class jCOPY {
public static void main(String args[]){
try {
jCOPY j = new jCOPY();
j.CopyFile(new File(args[0]),new File(args[1]));
}
catch (Exception e) {
e.printStackTrace();
}
} public void CopyFile(File in, File out) throws Exception {
FileInputStream fis = new FileInputStream(in);
FileOutputStream fos = new FileOutputStream(out);
byte[] buf = new byte[1024];
int i = 0;
while((i=fis.read(buf))!=-1) {
fos.write(buf, 0, i);
}
fis.close();
fos.close();
}
}
public static void main(String args[]){
try {
jCOPY j = new jCOPY();
j.CopyFile(new File(args[0]),new File(args[1]));
}
catch (Exception e) {
e.printStackTrace();
}
} public void CopyFile(File in, File out) throws Exception {
FileInputStream fis = new FileInputStream(in);
FileOutputStream fos = new FileOutputStream(out);
byte[] buf = new byte[1024];
int i = 0;
while((i=fis.read(buf))!=-1) {
fos.write(buf, 0, i);
}
fis.close();
fos.close();
}
}
解决方案 »
- swing做的登陆界面怎么保存用户名和密码?
- 请问怎样在JScrollPane打开的“图像”上用鼠标”画矩形“?
- 总结了一些日期时间常用的方法,做为自己的工具类很适用.
- java中的byte类型问题
- 为什么覆盖方法时,不能使用比父类中被覆盖的方法更严格的访问权限?
- JAVA面试一般问什么问题?
- 如果搞一个免费的J2ME入门培训,你有兴趣参加吗?
- 有的技术文章实在是害人不浅呀!!!
- 大家帮我看一看这份简历,有什么要改的吗?谢了:)
- 请问谁知道J2SE 1.3.1_02的下载地址啊??
- Api函数 file.createnewfile()为何老是报错?
- 有谁知道jdatastore的注册码吗?请给我回复
我还想知道java本身不通过复制文件的类库吗,是不是必须自己写方法来实现.