Here you can find the source of getFileContent(final String fileName)
public static StringBuilder getFileContent(final String fileName)
//package com.java2s; /**// w ww . ja v a 2s . co m * Copyright? 2014-2016 LIST (Luxembourg Institute of Science and Technology), all right reserved. * Authorship : Olivier PARISOT, Yoanne DIDRY * Licensed under GNU General Public License version 3 */ import java.io.*; public class Main { public static StringBuilder getFileContent(final String fileName) { final StringBuilder sb = new StringBuilder(); BufferedReader br = null; try { final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); if (is == null) throw new Exception("File '" + fileName + "' not found!"); br = new BufferedReader(new InputStreamReader(is, "ISO-8859-15")); String nextLine = ""; while ((nextLine = br.readLine()) != null) { sb.append(nextLine); sb.append("\n"); } } catch (Exception e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (Exception e) { e.printStackTrace(); } } } return sb; } }