新建一个文件,把原来文件内容读入其中。或者用这个试试File f=new File("template001.csv");
f.createNewFile();

解决方案 »

  1.   

    //你可以把相关代码放在构造函数中!本程序适用于任何类型文件、任何平台!
    import  java.io.*;
    //import java.util.TimeZone;
    class  CopyF
    {
       public  static  void  main(String arg[])
        throws  IOException    //使用FileInputStream和FileOutStream
       {   long l= System.currentTimeMillis();
           FileInputStream  fi=new  FileInputStream("1.jpg");
           FileOutputStream  fo=new  FileOutputStream("2.jpg");     byte[] b = new byte[1024];     int i=fi.read(b);
         while(i!=-1)   //当读到文件尾时返回-1
           {
              fo.write(b);
              i=fi.read(b);
            }
             fi.close();
             fo.close();
           l= (System.currentTimeMillis()-l)/1000;
           System.out.println(l);//显示复制花了多长时间
       }
    }
      

  2.   

    (1)新建文件 
      File f = new File("template001.csv");
    (2)文件输入和输出流:
      FileInputStream f1 = new  FlieInputStream(新文件名);
        FileOutputStream f2 = new  FlieOutputStream(欲读入文件名);
    (3)读入
       byte[] b = new byte[1024];
       int i=f2.read(b)!
       {读写}
    (4)关闭