读取本地文本写入list

/**
* 读取15151433862----123456文档
* @param f
*/
private static void findContent(File f){
String line = null;
try {
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(f), "gbk"));
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
try {
line = br.readLine();
while(line != null){
//读取一行记录,发送http请求
String[] strArr = line.split("----");
//System.out.println(strArr[0] +"======="+ strArr[1]+"======="+strArr[2]);
try {
modify(strArr[0],strArr[1],strArr[2]);
} catch (Exception e) {
e.printStackTrace();
}
line = br.readLine();

}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}

}

//测试
public static void main(String[] args) throws Exception {

File filename = new File("D:/号码.txt");

}

原文地址:https://www.cnblogs.com/yy123/p/4024920.html