conf reader

개발/Java 2006/07/19 13:54
[CODE type="java"]
if(data.canRead()){
[tab]try {
[tab][tab]
[tab][tab]String line;
[tab][tab]String item, value;
[tab][tab]Scanner sc = new Scanner(data);
[tab][tab]
[tab][tab]int idx;
[tab][tab]
[tab][tab]while(sc.hasNextLine()){
[tab][tab][tab]line = sc.nextLine();
[tab][tab][tab]if(line.trim().startsWith("#"))
[tab][tab][tab][tab]continue;
[tab][tab][tab]idx = line.indexOf('=');
[tab][tab][tab][tab][tab][tab][tab][tab][tab]
[tab][tab][tab]item = line.substring(0,idx).trim();
[tab][tab][tab]value = line.substring(idx+1).trim();
[tab][tab][tab]
[tab][tab]}
[tab][tab]
[tab][tab]
[tab]} catch (FileNotFoundException e) {
[tab][tab]
[tab][tab]e.printStackTrace();
[tab]}
[tab]
}
}[/HTML][/CODE]
2006/07/19 13:54 2006/07/19 13:54

Trackback Address :: 이 글에는 트랙백을 보낼 수 없습니다


: [1] : ... [13] : [14] : [15] : [16] : [17] : [18] : [19] : [20] : [21] : ... [28] :