Here you can find the source of ReadFile(String Path)
public static String ReadFile(String Path)
//package com.java2s; //License from project: BSD License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileInputStream; public class Main { public static String ReadFile(String Path) { BufferedReader reader = null; String laststr = ""; try {/*from w w w . j a v a2 s .c om*/ FileInputStream fileInputStream = new FileInputStream(Path); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8"); reader = new BufferedReader(inputStreamReader); String tempString = null; while ((tempString = reader.readLine()) != null) { laststr += tempString; } reader.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return laststr; } }