Java — reading from a file. Input stream vs. reader

后端 未结 3 542
清酒与你
清酒与你 2020-12-31 06:11

In every Java implementation I see of reading from a file, I almost always see a file reader used to read line by line. My thought would be that this would be terribly ineff

3条回答
  •  情书的邮戳
    2020-12-31 07:01

    You are comparing apples to bananas. Reading one line at a time is going to be less efficient even with a bufferedReader than grabbing data as fast as possible. Note that use of available is discouraged, as it is not accurate in all situations. I found this out myself when I started using cipher streams.

提交回复
热议问题