收藏 分享(赏)

javaIO流缓冲字符操作文件(复制).doc

上传人:精品资料 文档编号:10254174 上传时间:2019-10-25 格式:DOC 页数:2 大小:13.11KB
下载 相关 举报
javaIO流缓冲字符操作文件(复制).doc_第1页
第1页 / 共2页
javaIO流缓冲字符操作文件(复制).doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、package com.test.iostream;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;/* 字符缓冲流测试* 复制文件* author Administrator*/public class BufferSteamTest_01 public static void main(String args) long start = System.curren

2、tTimeMillis();copy();/复制字符文件long end = System.currentTimeMillis();System.out.println(“所需时间: “+(end-start)+“毫秒“);public static void copy() BufferedWriter bfw = null;BufferedReader bfr = null;try bfr = new BufferedReader(new FileReader(“c:sshmodel.log“);/读数据源bfw = new BufferedWriter(new FileWriter(“f:

3、IOtestBuffer.txt“);/写数据处String str = null;while(str = bfr.readLine() != null)bfw.write(str);bfw.newLine();bfw.flush(); catch (Exception e) throw new RuntimeException(“复制失败!“ ); finally if(bfw!=null)try bfw.close(); catch (IOException e) throw new RuntimeException(“缓冲写入流关闭失败!“);if(bfr != null)try bfr.close(); catch (IOException e) throw new RuntimeException(“缓冲读取流关闭失败!“);

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报