diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1593cf3..f0dc9ee 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,8 @@ - - - - + @@ -32,10 +29,11 @@ - - + + + @@ -534,7 +532,7 @@ - + 1521904777876 @@ -592,13 +590,17 @@ - - - - @@ -626,9 +628,12 @@ + + + - @@ -644,7 +649,7 @@ - + @@ -678,7 +683,8 @@ - @@ -1162,10 +1168,11 @@ - - + + + diff --git a/src/test/java/com/fjy/hadoop/UserAgentTest.java b/src/test/java/com/fjy/hadoop/UserAgentTest.java index cf0e64b..242e414 100644 --- a/src/test/java/com/fjy/hadoop/UserAgentTest.java +++ b/src/test/java/com/fjy/hadoop/UserAgentTest.java @@ -10,6 +10,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; /** * @author F嘉阳 @@ -26,6 +28,8 @@ public class UserAgentTest { String line = ""; int count = 0; + Map browerMap = new HashMap(); + UserAgentParser userAgentParser = new UserAgentParser(); while (line != null) { @@ -41,13 +45,23 @@ public class UserAgentTest { String os = agent.getOs(); String platform = agent.getPlatform(); boolean mobile = agent.isMobile(); + Integer browserValue = browerMap.get(browser); + if (browserValue != null) { + browerMap.put(browser, browerMap.get(browser) + 1); + } else { + browerMap.put(browser, 1); + } //输出解析的信息 System.out.println(browser + "," + engine + "," + engineVersion + "," + os + "," + platform + "," + mobile); } } - System.out.println("总记录数:"+count); + System.out.println("总记录数:" + count); + System.out.println("===================================="); + for (Map.Entryentry :browerMap.entrySet()){ + System.out.println(entry.getKey()+":"+entry.getValue()); + } } /**