How to get contents of file in a string please help.
Printable View
How to get contents of file in a string please help.
If your text file is small in size, the fastest way will be using the java.nio.file.Files.readAllLines() method. This method take a Path as a parameter. This method will then give the result as a collection, a List of String objects. You'll need to use Java 7 for this.
For detail you can find it here: Files (Java Platform SE 7 )