Here you can find the source of readFile(String filePath, Boolean replaceNewLineWithBr)
public static String readFile(String filePath, Boolean replaceNewLineWithBr) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main { public static String readFile(String filePath, Boolean replaceNewLineWithBr) throws IOException { String result = null;/*from w w w . jav a 2 s . c om*/ BufferedReader br = new BufferedReader(new FileReader(filePath)); StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); if (replaceNewLineWithBr) { sb.append("<br>"); } else { sb.append('\n'); } line = br.readLine(); } result = sb.toString(); br.close(); return result; } }