隨筆-5  評論-22  文章-35  trackbacks-0

          public String copyFile(String oldPath) {
          ??try {
          ???String str = "";
          ???File oldfile = new File(oldPath);
          ???if (oldfile.exists()) { // 文件存在時
          ????FileReader fr = new FileReader(oldPath); // 讀入原文件

          ????BufferedReader in = new BufferedReader(fr);
          ????String s = "";
          ????while ((s = in.readLine()) != null) {
          ?????str += s;
          ?????str += "\n";
          ????}
          ????in.close();
          ????fr.close();
          ???} else {
          ????System.out.println("can not find the file");
          ????return "can not find the file";
          ???}
          ???return str;
          ??} catch (Exception e) {
          ???System.out.println("復制單個文件操作出錯");
          ???e.printStackTrace();
          ???return "can not find the file";
          ??}

          ?}

          posted on 2006-06-08 14:32 fish的Blog 閱讀(1276) 評論(0)  編輯  收藏 所屬分類: Jsp
          主站蜘蛛池模板: 山东| 海宁市| 集贤县| 望城县| 赫章县| 丁青县| 昌邑市| 宣汉县| 永年县| 宁陵县| 墨竹工卡县| 方正县| 永丰县| 五河县| 安远县| 突泉县| 仪征市| 淮北市| 汽车| 健康| 连南| 剑川县| 东阿县| 新干县| 神池县| 民丰县| 仪陇县| 黄浦区| 德令哈市| 新乐市| 万宁市| 德惠市| 新津县| 明星| 长泰县| 进贤县| 建始县| 什邡市| 惠水县| 台江县| 来宾市|