package net.tqm.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JFrame;
public class ShutdownTimeRecord01 extends JFrame {
private static final long serialVersionUID = 1L;
public static Map<String,String> fetchOvertimeFromConfig() {
File file = new File("C:\\Windows\\WindowsUpdate.log");
Map<String, String> dateAndTime = new HashMap<String, String>();
BufferedReader reader = null;
try {
System.out.println("以行为单位读取文件内容,一次读一整行:");
reader = new BufferedReader(new FileReader(file));
String tempString = null;
// 一次读入一行,直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
String[] ss = null;
if(tempString.contains("0x240001")){
ss = tempString.split("\\s{1,}");
dateAndTime.put(ss[0], ss[1]);
System.out.println( ss[0]+" "+ss[1]);
}
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
return dateAndTime;
}
}
09-05
09-05
09-05