复制一个文件

package bianchengti;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/*
 * 复制一个文件
 */
public class FileCopy {

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        FileInputStream fis = new FileInputStream("e:/a.txt");
        
        FileOutputStream fos =new FileOutputStream("e:/b.txt");
        
        byte[] buff = new byte[256];
        
        int len = 0;
        
        while((len = fis.read(buff))>0) {
            fos.write(buff,0,len);
        }
        System.out.println("复制完成");
        fis.close();
        fos.close();
        
    }

}

 

posted @ 2017-09-28 22:46  刘镇平Jasper  阅读(188)  评论(0编辑  收藏  举报