java中使用IO流将以文件中的内容去取到指定的文件中

  public class Demo12 {
      public static void main(String[] args) throws IOException {
          File file=new File("1.txt");
         FileInputStream fis=new FileInputStream(file);
         FileOutputStream fos=new FileOutputStream(new File("4.txt"));
         byte[] bt=new byte[1024];
         int count;
         while((count=fis.read(bt))!=-1) {
            fos.write(bt,0,count);
       }
        fis.close();
        fos.close();
    }
 }

  

posted @ 2020-09-28 17:54  红尘沙漏  阅读(221)  评论(0编辑  收藏  举报