import java.io.*;
class Test
{
    public static void main(String args[]){
        FileInputStream fin =null;
        FileOutputStream fout = null;
        try{
            fin = new FileInputStream("e://d/from.txt");
            fout = new FileOutputStream("e://d/to.txt");
            byte [] arr =new byte[1024];

            while(true){
            int temp = fin.read(arr,0,arr.length);
                if(temp == -1){            //读取到末端返回-1
                break;
                }
            fout.write(arr,0,temp);
            }
            
        }catch(Exception e){
            System.out.println(e);
        }
        finally{            //关掉流
            try{
                fout.close();
                fin.close();
            }catch(Exception e){
                System.out.println(e);
            }
            
        }
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-01-29
  • 2022-01-02
  • 2022-03-10
猜你喜欢
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案