ITeye博客

一个Property文件封装类

java1573 · 2007-08-10 13:51 · 家娃部落 · Markdown

PropertyFile.java

package tools;

 

import ……

 

/**

 * 功能:工具函数,封装对属性文件的操作

 * @author LOVO

 */

public class PropertyFile {

       //私有属性成员

       private Properties prop;

       private String fileName;

 

       //初始化:指定文件名

       public PropertyFile(String _fileName){

              prop = new Properties();

              this.fileName = _fileName;

              load();

       }

       //读取文件到内存

       public void load(){

              prop.load(new FileInputStream(this.fileName));

       }

       //保存文件到磁盘中

       public boolean save(){

              prop.store(new FileOutputStream(this.fileName),null);

       }

       //读取鍵值

       public String getKeyValue(String _key){

              String value = prop.getProperty(_key);

       }

       //设置鍵值

       public void setKeyValue(String _key,String _value){

              prop.setProperty(_key, _value);

       }

}

评论(1)

  1. #1 楼 · java1573 · 2007-08-10 13:51

    SystemInput.java核心代码 BufferedReader bf = new BufferedReader( new InputStreamReader(System.in));

    String data = bf.readLine();

评论功能维护中,当前仅展示历史评论。