-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInfoRecord.java
42 lines (33 loc) · 1.06 KB
/
InfoRecord.java
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 com.support;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
public class InfoRecord {
public static final String AUTH_INFO_FILENAME = "auth_info.txt";
static PrintWriter writer = null;
public static void WriteScoreInfo(ArrayList<HashMap<String, Object>> list, String authname) {
String rootDir = Cfg.getInstance().getRootDir();
FileOutputStream authfos = null;
try {
authfos = new FileOutputStream(rootDir + AUTH_INFO_FILENAME, true);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
writer = new PrintWriter(authfos);
for (HashMap<String, Object> item : list) {
String name = (String) item.get("name");
Float score = (Float) item.get("score");
writer.print("<" + name + "," + score + "> ");
}
writer.println(authname + ";");
writer.close();
try {
authfos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}