当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesConfiguration.getStringArray方法代码示例

本文整理汇总了Java中org.apache.commons.configuration.PropertiesConfiguration.getStringArray方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConfiguration.getStringArray方法的具体用法?Java PropertiesConfiguration.getStringArray怎么用?Java PropertiesConfiguration.getStringArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration.PropertiesConfiguration的用法示例。


在下文中一共展示了PropertiesConfiguration.getStringArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recordInit

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
public void recordInit(String[] args) throws Exception {
	/*
	 * FileOutputStream out = new FileOutputStream(Enterence.propFileName);
	 * Enterence.prop.putIfAbsent("sudoers", Enterence.sudoers);
	 * Enterence.prop.putIfAbsent("sudoPwd", Enterence.sudoPwd);
	 * Enterence.prop.putIfAbsent("server", Enterence.server);
	 * Enterence.prop.putIfAbsent("name", Enterence.name);
	 * Enterence.prop.putIfAbsent("channels", Enterence.channels);
	 * Enterence.prop.putIfAbsent("preffix", Enterence.preffix);
	 * Enterence.prop.putIfAbsent("sudoers", Enterence.sudoers);
	 * Enterence.prop.store(out, null); out.close();
	 */

	if (file.exists()) {
		Gui.log("Record file found, start loading");
		try {
			PropertiesConfiguration config = new PropertiesConfiguration(
					Configs.recordFileName);
			Records.verifiedUsers.addAll(Arrays.asList(config
					.getStringArray("verifiedUsers")));
			Records.mutedUsers.addAll(Arrays.asList(config
					.getStringArray("mutedUsers")));

			// Records.records = (HashMap<String, HashSet<String>>)
			// config.getProperty("records");

			String[] usrEntries = config.getStringArray("usrEntries");
			Gui.log("Users Read:" + usrEntries.toString());
			for (String usr : usrEntries) {// per usr
				//Gui.log("loading:" + usr);
				String[] statements = config.getStringArray(usr);
				HashSet<String> statementsMap = new HashSet<String>();
				for (String statement : statements) {// per statement
					//Gui.log("    loading:" + statement);
					statementsMap.add(statement);
				}
				Records.records.put(usr, statementsMap);
				Gui.log("Record successfully loaded");
			}

			if (Records.verifiedUsers == null || Records.mutedUsers == null
					| Records.records == null) {
				throw new Exception("File damaged");
			}
		} catch (Exception e) {
			// Gui.displayException(e);
			Gui.log("Record file error: " + e.getMessage()
					+ ", creating one as default");
			createDefault();
		}
	} else {
		Gui.log("Record file not found, creating one as default");
		createDefault();
	}

}
 
开发者ID:D0048,项目名称:irc-helper,代码行数:57,代码来源:MyRecord.java


注:本文中的org.apache.commons.configuration.PropertiesConfiguration.getStringArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。