Here you can find the source of readTemplate(String filePath)
public static String readTemplate(String filePath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { public static String readTemplate(String filePath) throws IOException { File f = new File(filePath); if (!f.canRead()) throw new IOException(); BufferedReader in = new BufferedReader(new FileReader(filePath)); String template = ""; String line;//from w w w .ja v a 2s. c o m while ((line = in.readLine()) != null) { template += line; } in.close(); return template; } }