1 package org.javabb.infra; 2 3 import java.io.FileInputStream ; 4 import java.util.Properties ; 5 6 12 public class MaintainProperties { 13 private FileInputStream localFile = null; 14 private Properties properties = null; 15 16 17 public MaintainProperties(FileInputStream file) throws Exception { 18 localFile = file; 19 loadProperties(); 20 } 21 22 private void loadProperties() throws Exception { 23 if(localFile == null){ 24 throw new Exception ("Property is null: FileInputStream !"); 25 } 26 properties = new Properties (); 27 properties.load(localFile); 28 } 29 30 public String getProperty(String nmProperty) throws Exception { 31 if(properties == null){ 32 throw new Exception ("Property is null !"); 33 } 34 if(nmProperty == null) { 35 return null; 36 } 37 return properties.getProperty(nmProperty); 38 } 39 } 40 | Popular Tags |