Here you can find the source of readFile(String nameFile)
public static String readFile(String nameFile) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main { public static String readFile(String nameFile) throws IOException { StringBuilder sb = new StringBuilder(""); BufferedReader br = null; try {/*from w w w . j a v a 2 s. c o m*/ br = new BufferedReader(new FileReader(nameFile)); String linea; while ((linea = br.readLine()) != null) { sb.append(linea); } } catch (Exception e) { System.out.println(e.getMessage()); } finally { br.close(); } return sb.toString(); } }