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("復(fù)制單個文件操作出錯");
???e.printStackTrace();
???return "can not find the file";
??}
?}
posted on 2006-06-08 14:32
fish的Blog 閱讀(1274)
評論(0) 編輯 收藏 所屬分類:
Jsp