當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。