public String processInFile(String filestr) throws IOException{
File m_file = new File(filestr);
FileReader m_fileReader = null;
BufferedReader m_bufReader = null;
StringTokenizer m_strTok = null;
String m_line = "";
String m_xm = null;
String m_sfzh = null;
if(m_file.isFile()){
try {
m_fileReader = new FileReader(m_file);
m_bufReader = new BufferedReader(m_fileReader);
} catch (FileNotFoundException e) {
e.printStackTrace();
return "不存在此文件!";
}
do {
m_line = m_bufReader.readLine();
if(m_line == null){break;}
m_strTok = new StringTokenizer(m_line,"|");
//int m_n = m_strTok.countTokens();
while(m_strTok.hasMoreTokens()){
m_xm = m_strTok.nextToken();
m_sfzh = m_strTok.nextToken();
System.out.println("xm---"+m_xm+" sfzh=="+m_sfzh);
//在此连接数据库,把此人的姓名 身份证号写入数据库表中.
}
}while(m_line!=null && m_line.length()>0);
}else{
return "不是文件!";
}
return "success";
}