We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String str = ""; while ((str = ra.readLine()) != null) { line++; if (line == currentLine) { this.seek = ra.getFilePointer(); } } 你这样写的话就算跳到第十页都要循环完全部文件而且加上break的话我要跳到十万行也是很慢的。 我对你的代码稍稍修改了一下 `private void initBook() { FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(new File(bookFile)); bookList = IOUtils.readLines(fileInputStream, "UTF-8"); this.totalLine = bookList.size(); } catch (IOException e) { e.printStackTrace(); } }
String str = ""; while ((str = ra.readLine()) != null) { line++; if (line == currentLine) { this.seek = ra.getFilePointer(); } }
private String turnPage() { if (!this.bookList.isEmpty()) { currentLine++; return bookList.get(currentLine - 1); } return ""; }`
加到list的话对于行数大的小说来说跳页要快很多很多,亲测
The text was updated successfully, but these errors were encountered:
No branches or pull requests
String str = ""; while ((str = ra.readLine()) != null) { line++; if (line == currentLine) { this.seek = ra.getFilePointer(); } }
你这样写的话就算跳到第十页都要循环完全部文件而且加上break的话我要跳到十万行也是很慢的。
我对你的代码稍稍修改了一下
`private void initBook() {
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(new File(bookFile));
bookList = IOUtils.readLines(fileInputStream, "UTF-8");
this.totalLine = bookList.size();
} catch (IOException e) {
e.printStackTrace();
}
}
加到list的话对于行数大的小说来说跳页要快很多很多,亲测
The text was updated successfully, but these errors were encountered: