import java.io.*; public class Test3 { public static void main(String[] args) throws Exception { long l = System.currentTimeMillis();//当前时间,毫秒 BufferedInputStream bis = new BufferedInputStream(new FileInputStream("d:/aaa/good.txt")); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("d:/bbb/nice.txt")); byte[] b = new byte[1024]; int lenght; while ((lenght = bis.read(b)) != -1) {//输入流 硬盘到内存 bos.write(b, 0, lenght);//输出流,内存————>硬盘 // write(String str, int off, int len) //写一个字符串的一部分。 } bis.close(); bos.close(); long l1 = System.currentTimeMillis();//执行后时间。毫秒 System.out.println(l1 - l);//1毫秒 } }
io流中的字节流,运行流程介绍
最新推荐文章于 2024-07-12 16:03:26 发布