Here you can find the source of readFileIntoString(Path path)
public static String readFileIntoString(Path path)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.stream.Collectors; public class Main { public static String readFileIntoString(String file) { return readFileIntoString(new File(file)); }/*from ww w . j a v a 2 s . c o m*/ public static String readFileIntoString(File file) { return readFileIntoString(file.toPath()); } public static String readFileIntoString(Path path) { try { return Files.lines(path).collect(Collectors.joining("\n")); } catch (IOException e) { throw new RuntimeException(e); } } }