What is the shortest way to open file for reading with readLine() method and with setting of it’s encoding?
Is the following line correct and shortest?
BufferedReader reader =
new BufferedReader(
new InputStreamReader(
new FileInputStream(myPath), myEncoding));
With Scanner, you can do:
Scanner scan = new Scanner(new File(myPath), myEncoding)and thenscan.nextLine()which returns aString.