Read line using Java New I/O

前端 未结 3 1804
执念已碎
执念已碎 2021-01-21 07:49

What\'s the best way to read a line from a file using the New I/O ?

I can only get a byte at a time.

Any idea?

3条回答
  •  误落风尘
    2021-01-21 08:41

    BufferedReader's readline() method should be enough. Otherwise you have to read an arbitrary number of bytes and parse for the endline '\n' or \r\n' if it is in windows style line ending

提交回复
热议问题