复制文件

来源:互联网 发布:深圳土巴兔效果图软件 编辑:程序博客网 时间:2024/05/18 05:02

package com;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class demo01
{

 public static void main(String[] args) throws Exception
 {
  FileInputStream fi=new FileInputStream("d:\\aa.txt");
  FileOutputStream fo=new FileOutputStream("D:\

\bb.txt");
  byte[] buff=new byte[1024];
  int len=-1;
  while((len=fi.read(buff))>0)
  {
   fo.write(buff, 0, len);
   //System.out.println(buff);
   System.out.println("---->"+len);
  }
  fi.close();
  fo.close();
    

 }

 

原创粉丝点击