📄 confighand.java
字号:
package com.example.util;
import java.util.Properties;
import java.io.InputStream;
import java.io.IOException;
public class ConfigHand {
private ConfigHand() {
}
private static Properties prop = null;
public synchronized static Properties getConfigParams() {
if (prop == null) {
prop = new Properties();
ClassLoader cLoader = Thread.currentThread().getContextClassLoader();
InputStream in = cLoader.getResourceAsStream("conf/oc.properties");
try {
prop.load(in);
}
catch (IOException ex) {
System.err.print("配置文件未找到!\n" + ex.getMessage());
throw new RuntimeException("配置文件读取错误");
}
}
return prop;
}
public static String getValue(String paramName) {
String value = null;
value = getConfigParams().getProperty(paramName).trim();
return value;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -