/**
* 这是个配置文件操作类,用来读取和设置ini配置文件
* @author 由月
* @version 2004-08-18
*/
public final class ConfigurationFile {
/**
* 从ini配置文件中读取变量的值
* @param file 配置文件的路径
* @param section 要获取的变量所在段名称
* @param variable 要获取的变量名称
* @param defaultValue 变量名称不存在时的默认值
* @return 变量的值
* @throws IOException 抛出文件操作可能出现的io异常
*/
public static String getProfileString(
String file,
String section,
String variable,
String defaultValue)
throws IOException {
String strLine, value = "";
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
boolean isInSection = false;
try {
while ((strLine = bufferedReader.readLine()) != null) {
strLine =