标签:entryset 分析 edr sys erp java integer oop enter
private static void read()throws IOException{
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(new FileInputStream(new File("E:\\毕业设计\\东软\\7-17\\大数据第二天作业\\日志分析\\10000_access.log"))));
String line="";
UserAgentParser userAgentParser = new UserAgentParser();
Map<String,Integer> map=new HashMap<String,Integer>();
while(line!=null){
line=bufferedReader.readLine();
if(line!=null&&!line.equals("")){
int index=getCharacterPosition(line,"\"",7)+1;
String info=line.substring(index);
UserAgent agent = userAgentParser.parse(info);
String browser=agent.getBrowser();
Integer count=map.get(browser);
if(count!=null){
map.put(browser,count+1);
}else{
map.put(browser,1);
}
}
}
//遍历map
for(Map.Entry<String,Integer> entry:map.entrySet()){
String browser=entry.getKey();
Integer value=entry.getValue();
System.out.println("浏览器为:"+browser+"值:"+value);
}
}
|
标签:entryset 分析 edr sys erp java integer oop enter
原文地址:https://www.cnblogs.com/yibao/p/9330896.html