字符缓冲流 和字节缓冲流基本一样
public class ByteBufferDemo {
public static void main(String[] args) {
try (InputStream is = new FileInputStream("E:\\idea_java_project\\io_project\\src\\data.txt");
//把原始的字节输入流包装成高级的缓冲字节流输入流
InputStream bis = new BufferedInputStream(is);
OutputStream os = new FileOutputStream("E:\\idea_java_project\\io_project\\src\\data33.txt");
//把字节输出流管道包装成高级的缓冲字节输出流管道
OutputStream bos = new BufferedOutputStream(os);
){
byte[] buffer = new byte[1024];
int len;
while((len = bis.read()) != -1){
bos.write(buffer,0,len);
}
System.out.println("复制完成");
} catch (Exception e) {
e.printStackTrace();
}
}
}