Possible Duplicate:
Whole text file to a String in Java
How can I read a text file to the very end?
Actually I need to output the whole file into the screen, therefore I think that I need to get the whole data in the file as an String
.
Possible Duplicate:
Whole text file to a String in Java
How can I read a text file to the very end?
Actually I need to output the whole file into the screen, therefore I think that I need to get the whole data in the file as an String
.
Use FileUtils's readFileToString()
method.
String content = FileUtils.readFileToString(new File("file.txt"), "utf-8");