Java File Read getFileContentAsAString(final File aFile)

Here you can find the source of getFileContentAsAString(final File aFile)

Description

get File Content As A String

License

Open Source License

Declaration

public static String getFileContentAsAString(final File aFile) throws IOException 

Method Source Code

//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);
    }
}

Related

  1. getFileContent(final File f)
  2. getFileContent(final File file)
  3. getFileContent(final File srcFile)
  4. getFileContent(final String fileName)
  5. getFileContent(final String p_filename)
  6. getFileContentAsList(String filePath)
  7. getFileContentByLine(String filePath)
  8. getFileContentFromClasspath(String pathToFile)
  9. getFileContentIntoStrCategoriesDictionary( String fileName)