import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
public class CSVReader {
public HashMap getServerThesh() {
HashMap<String, String> serverThesh = new HashMap<String, String>();
try {
File file = new File("GD.csv");
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
while (dis.available() != 0) {
String line = dis.readLine();
String[] info = line.split(",");
serverThesh.put(info[0], info[1]);
}
return serverThesh;
} catch (Exception e) {
e.printStackTrace();
}
return serverThesh;
}
public static void main(String[] args) {
System.out.println(new CSVReader().getServerThesh().keySet().size());
}
}
No comments:
Post a Comment