Close scanner after use

master
John 2022-06-19 15:52:03 -07:00
parent ef95740a7b
commit 16fd96b3b6
1 changed files with 3 additions and 1 deletions

View File

@ -22,7 +22,9 @@ public class FileManager {
} else { } else {
Scanner fileReader = new Scanner(newFile); Scanner fileReader = new Scanner(newFile);
// using the delimiter \\Z reads the entire file at once // using the delimiter \\Z reads the entire file at once
return fileReader.useDelimiter("\\Z").next(); String returnString = fileReader.useDelimiter("\\Z").next();
fileReader.close();
return returnString;
} }
} }