流的对拷

public class FileEach {
    public static void main(String[] args){
        try {
            FileInputStream fis = new FileInputStream("C:\\a.html");//输入流
            FileOutputStream fos = new FileOutputStream("C:\\a_bak.html");//输入流

       //模版代码
int len = 0; byte[] buffer = new byte[1024]; while((len = fis.read(buffer)) > 0){ fos.write(buffer, 0, len); } fis.close(); fos.flush(); fos.close(); System.out.println("ok"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }

 

posted @ 2013-08-27 14:26  墨禾米说  阅读(576)  评论(0编辑  收藏  举报