- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
private void init() {
if(file != null) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line;
int delimeterPosition = 0;
while((line = reader.readLine()) != null) {
//drop empty lines
if(line.trim().isEmpty() || line.trim().startsWith(";") || line.trim().startsWith("//")) continue;
if((delimeterPosition = line.indexOf("=")) != -1) {
//drop values without keys
if(line.substring(0, delimeterPosition-1).trim().isEmpty()) continue;
hm.put(line.substring(0, delimeterPosition-1).trim(), line.substring(delimeterPosition));
}
}
} catch (IOException ex) {
trouble = true;
}
}
}
Комментарии (0) RSS
Добавить комментарий