Java tutorial
//package com.java2s; import java.io.*; public class Main { public static String getFileOutputString(String path) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader(path), 8192); StringBuilder sb = new StringBuilder(); String line = null; while ((line = bufferedReader.readLine()) != null) { sb.append("\n").append(line); } bufferedReader.close(); return sb.toString(); } catch (IOException e) { e.printStackTrace(); } return null; } }