-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPropertiesReader.java
More file actions
42 lines (32 loc) · 980 Bytes
/
PropertiesReader.java
File metadata and controls
42 lines (32 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package utils;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
public class PropertiesReader {
private Properties properties;
private String baseUrl;
private String inventoryUrl;
public PropertiesReader(String fileLocation) {
initProperties(fileLocation);
loadProperties();
}
private void loadProperties() {
baseUrl = properties.getProperty("baseUrl");
inventoryUrl = properties.getProperty("inventoryUrl");
}
public void initProperties(String fileLocation) {
properties = new Properties();
try {
properties.load(new InputStreamReader(new FileInputStream(fileLocation)));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String getBaseUrl() {
return baseUrl;
}
public String getInventoryUrl() {
return inventoryUrl;
}
}