第四次作业

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

 

public class CopyFile {

       /**

        * @param args

        */

       public static void main(String[] args) {

              try {

                     FileInputStream fis = new FileInputStream ("a.jpg");

                     FileOutputStream fos = new FileOutputStream ("temp.jpg");

                     int read = fis.read();            

                     while ( read != -1 ) {

                            fos.write(read);     

                            read = fis.read();

                     }                  

                     fis.close();

                     fos.close();

              } catch (IOException e) {

                     e.printStackTrace();

              }

       }

}

posted @ 2016-04-15 21:30  14软三农民小张  阅读(74)  评论(0编辑  收藏  举报