`
shoppingbill
  • 浏览: 58307 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Read .properties file

    博客分类:
  • Java
JDK 
阅读更多
rules.properties :

rule1.id=callagent
rule1.name=Longest Waiting 1
rule1.type=custom
rule1.class=com.brekeke.ctiserver.acd.RuleCallAgent
rule1.description=Assign a call to an agent who has been waiting the longest.
rule1.param1.target=agent_id
rule1.param1.label=Timeout (sec)
rule1.param2.label=Queue size
rule1.param3.label=Next number
rule1.param4.label=Next number14

rule2.id=test
rule2.name=High Skill 1
rule2.type=custom
rule2.description=Find an agent who has the highest skill.
rule2.rule1.id=callagent
rule2.rule2.id=callagent
rule2.param1.target=rule1.param1
rule2.param1.label=Timeout (sec)
rule2.param2.target=rule2.param1
rule2.param2.label=Queue size
rule2.param3.label=Next number
rule2.param4.label=Next number24

ReadPro.java
public class ReadPro {

	/**
	 * @author Bill Zhang
	 */
	public static void main(String[] args) {
          File file = new File("src/pro/rules.properties");
          if(file.exists()){
        	  try {
				FileInputStream fistream = new FileInputStream(file);
				InputStream inStream = new BufferedInputStream(fistream);
				Properties pro = new Properties();
				try {
					pro.load(inStream);
//					 System.out.println("=============Get Value By rule_id=====================");
//					 System.out.println(pro.get("rule1.id"));
					 System.out.println("===========================");
					Enumeration<?> enu = pro.propertyNames();
					while(enu.hasMoreElements()){ 
						String key = enu.nextElement().toString().trim(); 
						String[] strTemp = key.split("\\.");  //  "\\" is a convert symbol without it not work in the JDK 6.x
						for(int i=0; i<strTemp.length; i++){
							if(strTemp[i].equals("id")) 
							System.out.println(pro.get(key));
						}
					}
				} catch (IOException e) {
					System.out.println("+++++++++IOException++++++++");
					e.printStackTrace();
				}
			} catch (FileNotFoundException e) { 
                System.out.println("++++++++FileNotFoundException+++++++++++");
				e.printStackTrace();
			}
          }else{
        	  System.out.println("File Not Found!");
          }
          
	}

}
分享到:
评论

相关推荐

    C:\Users\Administrator\.gradle\caches\jars-1\cache.properties (系统找不到指定文件)解决办法

    C:\Users\Administrator\.gradle\caches\jars-1\cache.properties (系统找不到指定文件)解决办法

    hibernate3.6 文档(pdf 格式)

    1.1.3. The mapping file ...................................................................................... 4 1.1.4. Hibernate configuration ...........................................................

    txt文件阅读器

    read:该包中的Read_book.java和File_content.java Read_book 主体类,负责界面设计,以及一些基本的监听事件的处理 File_content 处理读取文件内容,通过IO流读取txt文件后对其内容进行处理,如行数num_plus,...

    JavaEE 5.0 Tutorial.pdf

    Sun 官方 J2ee 5.0 教程 The Java EE 5Tutorial For Sun Java System Application Server 9.1 Contents Preface ..................................................................................................

    spring-boot-reference.pdf

    24.7. Type-safe Configuration Properties 24.7.1. Third-party Configuration 24.7.2. Relaxed Binding 24.7.3. Merging Complex Types 24.7.4. Properties Conversion Converting durations 24.7.5. @...

    File access sample.zip

    This sample shows how to create, read, write, copy and delete a file, how to retrieve file properties, and how to track a file or folder so that your app can access it again. This sample uses Windows....

    Basic4Android 初學者指南 英文版

    4.1.2 File menu ............................................................................................................... 48 4.1.3 Edit menu.........................................................

    Java读取资源文件工具类--ReadConfigation(java源码)

    m_lastModifiedTime = m_file.lastModified(); if(m_lastModifiedTime == 0){ System.err.println(PFILE +" file does not exist!"); } m_props = new Properties(); try { m_props.load(new ...

    Hungry Minds - Visual Basic.NET Visual Blueprint (VBL).pdf

    1)GETTING STARTED WITH VISUAL BASIC .NET An Introduction to Visual Basic .NET ................................................................................2 Install Visual Studio .NET.................

    Guide to Scientific Computing in C++

    6.1.2 Abstraction, Encapsulation and Modularity Properties of Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 A First Example Simple Class: A Class of Books . . . . . . . . . 6.2.1 ...

    虚拟声卡-用于服务器电脑

    is an HTML Help format file. Do not open manual file from a network path or directly from the package otherwise help pages may not be displayed due to security restrictions. Copy the file to a local...

    ZendFramework中文文档

    4.3.5. Zend_Cache_Frontend_File 4.3.5.1. Introduction 4.3.5.2. Available options 4.3.5.3. Examples 4.3.6. Zend_Cache_Frontend_Page 4.3.6.1. Introduction 4.3.6.2. Available options (for this ...

    UNIX环境高级编程(第二版,英文版)

    read Function Section 3.8. write Function Section 3.9. I/O Efficiency Section 3.10. File Sharing Section 3.11. Atomic Operations Section 3.12. dup and dup2 Functions ...

    SystemVerilog Reference Manual 3.1a(中英文版)+最新SV IEEE 标准

    Table of Contents Section 1 Introduction to SystemVerilog ...................................................................................................... 1 Section 2 Literal Values................

    Doctrine ORM for PHP.pdf

    Bootstrap File.....................................................................................................................23 Test Script..........................................................

    python3.6.5参考手册 chm

    PEP 519: Adding a file system path protocol PEP 495: Local Time Disambiguation PEP 529: Change Windows filesystem encoding to UTF-8 PEP 528: Change Windows console encoding to UTF-8 PEP 520: ...

    java解析给定url

    Properties props = new Properties(); InputStream in = getClass().getResourceAsStream("/config.properties"); try { props.load(in); Enumeration en = props.propertyNames(); System.out.print("读取...

    Hibernate Reference Documentation3.1

    1.2.2. The mapping file 1.2.3. Hibernate configuration 1.2.4. Building with Ant 1.2.5. Startup and helpers 1.2.6. Loading and storing objects 1.3. Part 2 - Mapping associations 1.3.1. Mapping the ...

    EurekaLog_7.5.0.0_Enterprise

    4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL debug info, create .jdbg file, and create .dbg file (Microsoft debug format...

Global site tag (gtag.js) - Google Analytics