Here you can find the source of loadTextFile(String fileFullPath)
public static String loadTextFile(String fileFullPath)
//package com.java2s; /*//from w w w.j a v a 2 s . c om * DVFileUtil.java 2/9/13 1:39 PM * * Copyright (C) 2012-2013 Nick Ma * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; public class Main { public static String loadTextFile(String fileFullPath) { StringBuffer text = new StringBuffer(); BufferedReader input; try { File f = new File(fileFullPath); input = new BufferedReader(new FileReader(f)); while (input.readLine() != null) { text.append(input.readLine() + "\n"); } input.close(); } catch (Exception ioe) { return ioe.getMessage(); } return text.toString(); } }