1 2 34 35 package com.icesoft.jsfmeta.util; 36 37 import java.io.BufferedInputStream ; 38 import java.io.File ; 39 import java.io.FileInputStream ; 40 import java.io.FileNotFoundException ; 41 import java.io.IOException ; 42 import java.util.Properties ; 43 44 48 public class ConfigStorage { 49 50 private String fileName; 51 52 private ConfigStorage(String fileName) { 53 this.fileName = fileName; 54 } 55 56 public static ConfigStorage getInstance(String fileName){ 57 58 return new ConfigStorage(fileName); 59 } 60 61 public Properties loadProperties(){ 62 63 Properties properties = new Properties (); 64 try { 65 properties.load(new BufferedInputStream (new FileInputStream (new File (fileName)))); 66 } catch (FileNotFoundException e){ 67 e.printStackTrace(); 68 System.exit(1); 69 } catch (IOException e){ 70 e.printStackTrace(); 71 System.exit(1); 72 } 73 74 return properties; 75 } 76 77 78 79 } 80 | Popular Tags |