随笔-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 阅读(381) 评论(0)  编辑  收藏 所属分类: Java

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


网站导航:
 
MSN:envoydada@hotmail.com QQ:34935442