?? filesetting.java
字號:
package com.cn.darkblue.util;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class FileSetting {
private static final Log log = LogFactory.getLog(FileSetting.class);
private Properties properties = null;
private String propFile;
public void init(String fileName){
propFile = fileName;
String path = propFile;
try {
InputStream is = new FileInputStream(path);
properties = new Properties();
properties.load(is);
is.close();
} catch (Exception e) {
log.error(e.getMessage());
}
}
public String getParam(String key){
return properties.getProperty(key);
}
public void setParam(String key, String value) {
try {
InputStream is = new FileInputStream( propFile);
Properties properties = new Properties();
properties.load(is);
properties.setProperty(key, value);
is.close();
OutputStream out = new FileOutputStream(propFile);
properties.save(out, "save");
out.close();
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -