- package com.heima.test;
- import java.io.BufferedInputStream;
- import java.io.BufferedOutputStream;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- public class Test1_fileInPutStream {
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- //FileInputStream fis = new FileInputStream("xxx.txt"); //使用自定义数组拷贝文件
- BufferedInputStream bis = new BufferedInputStream(new FileInputStream("xxx.txt")); //使用高效流拷贝文件
- //FileOutputStream fos = new FileOutputStream("copy.txt");
- BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("copy.txt"));
- int a ;
- while ((a = bis.read()) != -1) {
- bos.write(a);
- }
- bis.close ();
- bos.close ();
- }
- }
复制代码 |
|