隨筆-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
          主站蜘蛛池模板: 佳木斯市| 陇川县| 邵东县| 吉首市| 瓮安县| 西乌珠穆沁旗| 宝兴县| 平阳县| 湄潭县| 阳曲县| 儋州市| 馆陶县| 隆安县| 丘北县| 木里| 大港区| 平湖市| 江津市| 会东县| 永靖县| 娄烦县| 台南县| 奈曼旗| 磐安县| 灵丘县| 屏东县| 峨眉山市| 岳阳县| 普陀区| 嘉义县| 资中县| 荥经县| 正镶白旗| 潞西市| 松原市| 甘谷县| 上思县| 白沙| 崇阳县| 元朗区| 九江县|