I was searching on the internet and came across this code to read files from a file and convert it into a string. But I don't understand how `in.read(arr)` is reading all the contents of a file at once.

```
   import java.util.Scanner;
   import java.io.*;
   class Main{
       public static void main(String[] args)
       {
         Scanner sc = new Scanner(System.in);
         String s = sc.next();
         try
         {
           File file = new File(s);
           BufferedReader in = new BufferedReader(new FileReader(file));
           int c;
           char arr[] = new char[(int)file.length()];
           in.read(arr);
           String res = new String(arr);
           System.out.println(res);
         }
         catch(Exception e){}
       }
   }

```