IO流 字节流的缓冲区
package com.yyq; /* * 字节流的缓冲区 */ import java.io.*; public class CopyMP3 { public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); copy_1(); long end = System.currentTimeMillis(); System.out.println(end-start); } public static void copy_1() throws Exception{ BufferedInputStream bufis = new BufferedInputStream( new FileInputStream("1.jpg")); BufferedOutputStream bufos = new BufferedOutputStream( new FileOutputStream("2.jpg")); byte[] buf = new byte[1024]; int num = 0; while((num = bufis.read(buf))!=-1){ bufos.write(buf); } } }