1 16 17 package com.jdon.util; 18 19 import java.io.*; 20 import com.jdon.util.jdom.*; 21 22 25 26 public class PropsUtil { 27 28 public final static String module = PropsUtil.class.getName(); 29 30 public static String ENCODING = "UTF-8"; 31 32 private XMLProperties properties; 33 34 private FileLocator fileLocator = new FileLocator(); 35 36 37 public PropsUtil(String configureFile) { 38 loadProperties(configureFile); 39 } 40 41 public void loadProperties(String configName) { 42 InputStream pathCongfgName = fileLocator.getConfStream(configName); 43 if (pathCongfgName == null) { 44 System.out.println(" cann't load config file:-->" + configName); 45 return; 46 } 47 this.properties = new XMLProperties(pathCongfgName); 48 } 49 50 51 public String getProperty(String name) { 52 String res = properties.getProperty(name); 53 if (res == null) 54 res = ""; 55 return res; 56 } 57 58 59 public void setProperty(String name, String value) { 60 properties.setProperty(name, value); 61 } 62 63 } 64 | Popular Tags |