feat: 优化代码

pull/178/head
kunfei 5 years ago
parent cb73b58dcb
commit 238dc19e69
  1. 3
      app/src/main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt

@ -63,7 +63,8 @@ class AnalyzeTxtFile {
while (bookStream.read(buffer).also { length = it } > 0) { while (bookStream.read(buffer).also { length = it } > 0) {
blockPos++ blockPos++
//如果存在Chapter //如果存在Chapter
if (rulePattern != null) { //将数据转换成String if (rulePattern != null) {
//将数据转换成String, 不能超过length
var blockContent = String(buffer, 0, length, charset) var blockContent = String(buffer, 0, length, charset)
val lastN = blockContent.lastIndexOf("\n") val lastN = blockContent.lastIndexOf("\n")
if (lastN > 0) { if (lastN > 0) {

Loading…
Cancel
Save