Here you can find the source of readFile(String location)
public static String readFile(String location)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static String readFile(String location) { try {/*from w w w . jav a2s . c om*/ InputStream in = new FileInputStream(new File(location)); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder out = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { out.append(line); } reader.close(); return out.toString(); } catch (Exception e) { System.out.println(String.format("CWD = %s", System.getProperty("user.dir"))); System.out.println(e); return ""; } } }