Scanner vs. BufferedReader

前端 未结 12 1766
死守一世寂寞
死守一世寂寞 2020-11-22 02:17

As far I know, the two most common methods of reading character-based data from a file in Java is using Scanner or BufferedReader. I also know that

12条回答
  •  难免孤独
    2020-11-22 02:58

    Scanner is used for parsing tokens from the contents of the stream while BufferedReader just reads the stream and does not do any special parsing.

    In fact you can pass a BufferedReader to a scanner as the source of characters to parse.

提交回复
热议问题