User java.nio.Files
to read all lines of file.
public String readFile() throws IOException { File fileToRead = new File("file path"); List<String> fileLines = Files.readAllLines(fileToRead.toPath()); return StringUtils.join(fileLines, StringUtils.EMPTY);}