隨筆-86  評論-33  文章-0  trackbacks-0
          File f  =   new  File( " c:\\my.properties " );
                  Properties prop 
          =   new  Properties();
                  
          if  (f.exists()) {
                      
          try  {
                          InputStream in 
          =   new  FileInputStream(f);
                          prop.load(in);
                          in.close();
                          System.out.println(prop.get(
          " requestTime " )); // 讀properties文件
                          OutputStream out  =   new  FileOutputStream(f);
                          prop.setProperty(
          " derek " , " dada " ); // 設置屬性
                          prop.store(out, " THE LOCKED TIME SET " ); // 寫properties文件                
                      }  catch  (FileNotFoundException ex) {ex.printStackTrace();
                      } 
          catch  (IOException ex) {ex.printStackTrace();}
                  }
          else  System.out.println( " 文件不存在 " );
          posted on 2006-04-06 18:58 Derek.Guo 閱讀(389) 評論(0)  編輯  收藏 所屬分類: Java
          MSN:envoydada@hotmail.com QQ:34935442
          主站蜘蛛池模板: 太白县| 嘉善县| 施甸县| 固镇县| 拉孜县| 丰原市| 济阳县| 武乡县| 英山县| 玉树县| 永泰县| 清涧县| 吕梁市| 德州市| 左贡县| 葵青区| 永康市| 潮州市| 嵩明县| 米脂县| 南郑县| 西昌市| 荥经县| 怀集县| 吴川市| 新野县| 灌南县| 鄂尔多斯市| 神木县| 射洪县| 北安市| 桃园市| 习水县| 兴城市| 留坝县| 泗阳县| 阳江市| 三穗县| 黎城县| 绩溪县| 松滋市|