Does the Scanner class load the entire file into memory at once?

前端 未结 4 599
轮回少年
轮回少年 2020-12-07 02:15

I often use the Scanner class to read files because it is so convenient.

      String inputFileName;
      Scanner fileScanner;

      inputFileName = \"inp         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 02:52

    From reading the code, it appears to load 1 KB at a time by default. The size of the buffer can increase for long lines of text. (To the size of the longest line of text you have)

提交回复
热议问题