Here you can find the source of readFileFromDisk(String filepath)
public static String readFileFromDisk(String filepath)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; public class Main { public static String readFileFromDisk(String filepath) { FileInputStream fis = null; BufferedReader br = null; StringBuffer sb = new StringBuffer(); String temp = ""; try {//w w w .j a v a2 s . c o m fis = new FileInputStream(filepath); br = new BufferedReader(new InputStreamReader(fis, "utf-8")); while ((temp = br.readLine()) != null) { sb.append(temp).append("\n"); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (fis != null) { fis.close(); } } catch (Exception e2) { e2.printStackTrace(); } } return sb.toString(); } }