01: package org.testng.internal;
02:
03: import java.io.File;
04: import java.io.FileInputStream;
05: import java.io.IOException;
06: import java.util.Properties;
07:
08: /**
09: * This class loads and abstracts remote.properties
10: *
11: * @author cbeust
12: * @author Guy Korland
13: * @date April 13, 2006
14: */
15: public class PropertiesFile {
16:
17: private Properties m_properties = new Properties();
18:
19: /**
20: * Loads a Properties file.
21: *
22: * @param fileName properties file path
23: * @throws IOException if an error occurred when reading from the Properties file.
24: */
25: public PropertiesFile(String fileName) throws IOException {
26: FileInputStream fis = null;
27: //
28: // Parse the Properties file
29: //
30: try {
31: fis = new FileInputStream(new File(fileName));
32: m_properties.load(fis);
33: } finally {
34: if (fis != null)
35: fis.close();
36: }
37: }
38:
39: /**
40: * Returns the properties loaded.
41: * @return loaded properties.
42: */
43: public Properties getProperties() {
44: return m_properties;
45: }
46: }
|