Here you can find the source of readFile(String nomeFile)
public static String readFile(String nomeFile) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String readFile(String nomeFile) throws IOException { InputStream is;// w w w . j a va 2 s . c om InputStreamReader isr = null; StringBuilder sb = new StringBuilder(); char[] buf = new char[1024]; int len; try { is = new FileInputStream(nomeFile); isr = new InputStreamReader(is); while ((len = isr.read(buf)) > 0) { sb.append(buf, 0, len); } return sb.toString(); } finally { if (isr != null) { isr.close(); } } } }