Packagetest;ImportJava.io.BufferedReader;ImportJava.io.File;ImportJava.io.FileInputStream;ImportJava.io.InputStreamReader;ImportJava.util.Map;ImportJava.util.TreeMap; Public classCount { Public Static voidMain (string[] args)throwsException {File file=NewFile ("D:/kht_d2.log"); BufferedReader in=NewBufferedReader (NewInputStreamReader (NewFileInputStream (file), "UTF-8")); Map<string, integer> map =read (in); for(String str:map.keySet ()) {System.out.println (str+ "=" +map.get (str)); } in.close (); } Public StaticMap<string, integer> read (BufferedReader in)throwsException {Map<string, integer> map =NewTreemap<string, integer>(); String Str=NULL; intCount = 0; while(str = in.readline ())! =NULL) { if(Str.length () > && (Str.indexof ("")! =-1) ) {String date= Str.substring (Str.indexof (":") + 1, Str.indexof (":") + 11); if(Map.get (date) = =NULL) {Count= 0; Map.put (date,++count); } Else{map.put (date,++count); } } } returnmap; } }
Description
This is the number of requests sent from our platform to other platforms, the idea is to verify each line of keywords, if there is 1 operation
Log Request Count