Here you can find the source of readStringFromPath(Path path)
public static String readStringFromPath(Path path) throws Exception
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileReader; import java.nio.file.Path; public class Main { public static String readStringFromPath(Path path) throws Exception { FileReader fr = new FileReader(path.toString()); BufferedReader br = new BufferedReader(fr); String content;/*from w w w . j av a 2 s . c o m*/ try { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append('\n'); line = br.readLine(); } content = sb.toString(); } finally { br.close(); } return content; } }