class ServiceConfig{
private static Properties params = new Properties();
public static void load() {
InputStream is = ServiceConfig.class.getResourceAsStream(configFile); try { params.load(is); } catch (Exception e) { throw new RuntimeException("无法读取配置信息:" + e.getMessage()); } }
public static void save() { URL url = ServiceConfig.class.getResource(configFile); try { OutputStream os = new FileOutputStream(url.getFile()); params.store(os, null); } catch (Exception e) { throw new RuntimeException("无法将配置信息写入配置文件:" + e.getMessage()); } } }