Here you can find the source of read(String path)
public static String read(String path) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; public class Main { public static String read(String path) throws IOException { String content = ""; List<String> lines = Files.readAllLines(Paths.get(path), StandardCharsets.UTF_8); for (String line : lines) { content += line + "\n"; }/* w w w .java 2 s.c o m*/ return content; } }