Here you can find the source of getFileContent(String fileName)
public static String getFileContent(String fileName) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.BufferedInputStream; import java.io.DataInputStream; public class Main { public static String getFileContent(String fileName) throws Exception { File file = new File(fileName); FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); DataInputStream dis = new DataInputStream(bis); StringBuffer content = new StringBuffer(); while (dis.available() != 0) { content.append(dis.readLine()); }/* ww w . ja v a 2 s. c o m*/ fis.close(); bis.close(); dis.close(); return content.toString(); } }