/**
* @读取本地txt文件
* @param file
* @param request
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
@RequestMapping("updateWord")
public String updateWord() throws Exception {
String encoding="utf-8";
String filePath="F:\\项目任务\\6-其他项目\\华为\\全部.txt";
File file2=new File(filePath);
String name ="";
InputStreamReader read = new InputStreamReader(
new FileInputStream(file2),encoding);//考虑到编码格式
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
while((lineTxt = bufferedReader.readLine()) != null){
lineTxt=lineTxt.replace("华为", "").trim();
name +=lineTxt+",";
}
System.out.println(name);
read.close();
return "success";
}