Here you can find the source of getFileContent(String fName)
public static String getFileContent(String fName)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; public class Main { public static String getFileContent(String fName) { File f = new File(fName); String ret = ""; if (!f.exists()) { return ret; }//from w ww .ja v a 2 s . com try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f))); String l; while ((l = br.readLine()) != null) { ret += l; } } catch (Exception ex) { ex.printStackTrace(); } return ret; } }