Reading a specific line from a text file in Java

后端 未结 9 748
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 07:34

Is there any method to read a specific line from a text file ? In the API or Apache Commons. Something like :

String readLine(File file, int lineNumber)
         


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 07:54

    If you are going to work with the same file in the same way (looking for a text at certain line) you can index your file. Line number -> offset.

提交回复
热议问题