性格决定命运,气度影响格局
posts - 20, comments - 18, trackbacks - 0, articles - 1
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

一个实现了文件拷贝的小程序

Posted on 2007-07-31 14:16 尚爱军 阅读(213) 评论(0)  编辑  收藏

import java.io.*;

public class FileCopy {
 public static void main(String[] args) {
  int  temp = 0;
  
  try {
   
   BufferedInputStream bis = new BufferedInputStream(new FileInputStream("d:\\111042010449.wmv"));
   BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("d:\\1110.wmv"));
   while((temp=bis.read()) !=-1) {
    bos.write(temp);
   }
   bis.close();
   bos.flush();
   bos.close();
  }catch (IOException e) {
   e.printStackTrace();
   System.out.println("文件读取错误!!!");
  }
  System.out.println("文件拷贝成功!!!");
 }
}


只有注册用户登录后才能发表评论。


网站导航: