标签:
假设有一个test.pjroperties文件等待读取
1 Properties pro = new Properties(); 2 InputStream in = getClass().getResourceAsStream("test.properties"); 3 Map<String,String> map = new HashMap<>(); 4 try { 5 pro.load(in); 6 Enumeration<?> en = pro.propertyNames(); 7 while(en.hasMoreElements()){ 8 String key = (String)en.nextElement(); 9 String value = pro.getProperty(key); 10 map.put(key, value); 11 } 12 } catch (IOException e) { 13 // TODO Auto-generated catch block 14 e.printStackTrace(); 15 }
标签:
原文地址:http://www.cnblogs.com/kirno/p/4176648.html