Java File Content Read getFileContent(String path)

Here you can find the source of getFileContent(String path)

Description

get File Content

License

Open Source License

Declaration

public static String getFileContent(String path) throws IOException 

Method Source Code


//package com.java2s;
// Released under the terms of the GNU General Public License version 2 or later.

import java.io.*;

public class Main {
    public static String getFileContent(String path) throws IOException {
        File input = new File(path);
        return getFileContent(input);
    }//from w w w.j a  v a  2s .  c  o m

    public static String getFileContent(File input) throws IOException {
        char chars[] = new char[(int) (input.length())];
        FileReader in = new FileReader(input);
        in.read(chars);
        in.close();
        return new String(chars);
    }
}

Related

  1. getFileContent(String filePath)
  2. getFileContent(String filepath)
  3. getFileContent(String fName)
  4. getFileContent(String path)
  5. getFileContent(String path)
  6. getFileContent(String path)
  7. getFileContent(String path)
  8. getFileContent(String path, String encoding)
  9. getFileContent(String pythonSource)