欢迎来到天天文库
浏览记录
ID:37844943
大小:38.00 KB
页数:12页
时间:2019-06-01
《java--数据采集系统》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、java--数据采集系统分类:Android开发java讨论区2011-09-0417:18173人阅读评论(0)收藏举报Gather采集类:packagecom.briup.woss.client.impl;importjava.io.*;importjava.sql.Timestamp;importjava.util.*;importcom.briup.pojos.BIDR;importcom.briup.woss.client.Gather;publicclassGatherImplimplementsGather{privatestaticMapmap
2、=newHashMap();/* *读取up.dat文件,up.dat文件存放的是用户没下线的信息, *规定格式为:loginIp,userinfo;*/privatestaticFileReaderfr;privatestaticBufferedReaderbr;static{try{fr=newFileReader("data/up.dat");br=newBufferedReader(fr);Stringstr;while((str=br.readLine())!=null){StringsubStr[]=str.split(";");for(inti=
3、0;igather()throwsException{Collectionc=newArrayList<
4、BIDR>();FileReaderfr=newFileReader("data/radwtmp");BufferedReaderbr=newBufferedReader(fr);intpoint=readPointFile();intp=point;Stringstr=null;inttemp=1;/* *读取point文件来确定从哪一条记录开始读 */while((str=br.readLine())!=null){if(temp<=p){temp++;continue;}point++;Stringstr1[]=str.split("[
5、]+");if(
6、str1[2].equals("7")){map.put(str1[4],str);}elseif(str1[2].equals("8")){Stringsub=(String)map.get(str1[4]);if(sub!=null){Stringinfo[]=sub.split("[
7、]+");Stringlogin_name=info[0].replace("#","");//去除用户名前面的"#"BIDRbidr=newBIDR();//得到登陆用户名bidr.setAAA_login_name(login_name);//得到登陆IPbidr.se
8、tLogin_ip(info[4]);//得到NAS的IPbidr.setNAS_ip(info[1]);/**创建Timestamp类型的ts1(上线),ts2(下线)*/Timestampts1=newTimestamp(Long.parseLong(info[3]+"000"));Timestampts2=newTimestamp(Long.parseLong(str1[3]+"000"));//得到上线时间bidr.setLogin_date(ts1);//得到下线时间bidr.setLogout_date(ts2);//得到上网时间,以分钟计算int
9、secondTime=Integer.parseInt(str1[3])-Integer.parseInt(info[3]);intminuTime=secondTime/60+1;if(secondTime%60==0)minuTime=secondTime/60;bidr.setTime_deration(minuTime);c.add(bidr);map.remove(str1[4]);}}if(point%100==0)break;}br.close();fr.close();updatePointFile(point);//更新书签updateUpF
10、ile();returnc;}//读取
此文档下载收益归作者所有