Java tutorial
import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; public class Main { /** * Converts a file to a string * @param f The file * @return The string * @throws IOException Thrown in any IOException occurs */ public static String fileToString(File f) throws IOException { ArrayList<String> list = new ArrayList<>(Files.readAllLines(f.toPath())); StringBuilder builder = new StringBuilder(); list.forEach(builder::append); return builder.toString(); } }