如何用JAVA写的程序拷贝文件

linyi0731 2004-01-01 08:10:23
请帮帮忙呀.....用两个文本框,,,和一个按钮,,,,文本框是用来输入文件名的.
...全文
73 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
whyxx 2004-01-06
  • 打赏
  • 举报
回复
给你一个拷贝文件的例子,其他应该很简单了
File file = new File("D:\\myTemp\\aaa.rar");
FileInputStream in = new FileInputStream(file);
FileOutputStream out = new FileOutputStream(new File("D:\\myTemp\\bbb.rar"));
byte data[] = new byte[1024];
int count = 0;
while ((count = in.read(data, 0, 1024)) != -1) {
out.write(data, 0, count);
}
in.close();
out.flush();
out.close();
turbocrm 2004-01-06
  • 打赏
  • 举报
回复
跪求大家,帮我看看这个问题,谢谢!!!!!!!!!!!!!

http://expert.csdn.net/Expert/topic/2633/2633574.xml?temp=.6377375

23,407

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧