读取本地文本写入list

时间:2014-10-14 18:47:40   收藏:0   阅读:102

/**
* 读取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");

}

原文:http://www.cnblogs.com/yy123/p/4024920.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!