mirror of
https://gitee.com/jzsw-it/yexuejc-base.git
synced 2025-06-06 22:04:04 +08:00
[update]FileUtil优化分页读取
This commit is contained in:
parent
667ad26971
commit
c4fc4bd4f8
@ -120,4 +120,8 @@ public class ReadFileBean<T> {
|
||||
public String lineScavenge(String lineData) {
|
||||
return this.lineScavenger.apply(lineData);
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return this.fileLength > this.pointer;
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ public class FileUtil {
|
||||
List<String> datas = new ArrayList<>();
|
||||
int row = 1;
|
||||
String line;
|
||||
while ((line = randomAccessFile.readLine()) != null && row < readFileBean.getReadRowNum()) {
|
||||
while ((line = randomAccessFile.readLine()) != null && row <= readFileBean.getReadRowNum()) {
|
||||
row++;
|
||||
readFileBean.setPointer(randomAccessFile.getFilePointer());
|
||||
datas.add(readFileBean.lineScavenge(charsetDecode(line, readFileBean.getReadCharset()))); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user