|
1 |
| package net.sf.crispy.properties; |
|
2 |
| |
|
3 |
| import java.io.FileInputStream; |
|
4 |
| import java.io.InputStream; |
|
5 |
| import java.util.Properties; |
|
6 |
| |
|
7 |
| import net.sf.crispy.PropertiesLoader; |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| public class FilePropertiesLoader implements PropertiesLoader { |
|
16 |
| |
|
17 |
| private String fileName = null; |
|
18 |
| |
|
19 |
2
| public FilePropertiesLoader(String pvFileName) {
|
|
20 |
2
| fileName = pvFileName;
|
|
21 |
| } |
|
22 |
| |
|
23 |
3
| public Properties load() {
|
|
24 |
3
| Properties lvProperties = new Properties();
|
|
25 |
3
| try {
|
|
26 |
3
| InputStream lvInputStream = new FileInputStream(fileName);
|
|
27 |
2
| lvProperties.load(lvInputStream);
|
|
28 |
| } catch (Exception e) { |
|
29 |
1
| throw new PropertiesLoadException("Error in load-method:", e);
|
|
30 |
| } |
|
31 |
2
| return lvProperties;
|
|
32 |
| } |
|
33 |
| |
|
34 |
| } |