How can I read a large text file line by line using Java?

前端 未结 21 2841
心在旅途
心在旅途 2020-11-21 05:48

I need to read a large text file of around 5-6 GB line by line using Java.

How can I do this quickly?

21条回答
  •  没有蜡笔的小新
    2020-11-21 06:33

    You need to use the readLine() method in class BufferedReader. Create a new object from that class and operate this method on him and save it to a string.

    BufferReader Javadoc

提交回复
热议问题