Here you can find the source of getFileContentAsAString(final File aFile)
public static String getFileContentAsAString(final File aFile) throws IOException
//package com.java2s; /****************************************************************************** * * CoreWall / Corelyzer - An Initial Core Description Tool * Copyright (C) 2004 - 2007 Arun Gangadhar Gudur Rao, Julian Yu-Chung Chen * Electronic Visualization Laboratory, University of Illinois at Chicago * * This software is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either Version 2.1 of the License, or * (at your option) any later version./* w w w.jav a 2 s . c o m*/ * * This software 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 Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser Public License along * with this software; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about CoreWall should be directed to * cavern@evl.uic.edu * *****************************************************************************/ import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { public static String getFileContentAsAString(final File aFile) throws IOException { FileInputStream fis = new FileInputStream(aFile); int x = fis.available(); byte b[] = new byte[x]; fis.read(b); return new String(b); } }