Here you can find the source of read(String aPathString)
public static String read(String aPathString) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static String read(String aPathString) throws IOException { StringBuilder sb = new StringBuilder(); Path path = Paths.get(aPathString); try (BufferedReader reader = Files.newBufferedReader(path, Charset.defaultCharset())) { String line = reader.readLine(); while (line != null) { sb.append(line);//from w w w . j a v a2 s . c om sb.append(System.lineSeparator()); line = reader.readLine(); } } return sb.toString(); } }