我现在有一个文本文件,需要一行一行读取出来,数据量很大。
Java code
String temp = null;
String[] args = null;
while((temp=reader.readline())!=null){
args = temp.split("[|]");
if(null!=dao.findbyid(args[2])){
System.out.println(temp);
}
}
reader.close();
像这种操作大量字符串数据的应该怎么做?StringBuffer类拼接字符串我晓得了,其他的呢?
Java code
String temp = null;
String[] args = null;
while((temp=reader.readline())!=null){
args = temp.split("[|]");
if(null!=dao.findbyid(args[2])){
System.out.println(temp);
}
}
reader.close();
像这种操作大量字符串数据的应该怎么做?StringBuffer类拼接字符串我晓得了,其他的呢?
dao.findbyid(args[2]))
还有可能是这里边的问题,要一行一行的去分析一个文件,方法就是你这样的啊.你又没有把每一行加上起来,那样才说要用StringBuffer之类的,减少String重构
定时clear一下session就可以了。
既然你是判断一下对象是否存在的,那就要不每次都get对象好了,就执行HQL或者SQL判断一下.