Here you can find the source of getFileContent(String filename)
@Nullable public static String getFileContent(String filename)
//package com.java2s; //License from project: Open Source License import javax.annotation.Nullable; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Main { /**/* w ww . j av a 2s .com*/ * Helper function for reading file */ @Nullable public static String getFileContent(String filename) { String content = null; File file = new File(filename); if (!file.exists()) { return null; } try { FileReader reader = new FileReader(file); char[] chars = new char[(int) file.length()]; reader.read(chars); content = new String(chars); reader.close(); } catch (IOException e) { e.printStackTrace(); } return content; } }