设为首页 加入收藏

TOP

Java实现文件拷贝(三)
2014-11-24 02:56:01 来源: 作者: 【 】 浏览:3
Tags:Java 实现 文件 拷贝
xception
*/
private static void coypByStream() throws IOException {
long startTime = System.currentTimeMillis();
FileInputStream fin = new FileInputStream(FROM_FILE);
FileOutputStream fout = new FileOutputStream("G:/to6.rar");
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
int ins = fin.read(buffer);
if (ins == -1) {
fin.close();
fout.flush();
fout.close();
break;
} else{
fout.write(buffer, 0, ins);
}
}
long endTime = System.currentTimeMillis();
System.out.println("coypByStream time consumed(buffer size take effect) : " + (endTime - startTime));
}
}


首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Java多线程模式 下一篇Android_ListView用法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: