Java File Content Read getFileContent(File file)

Here you can find the source of getFileContent(File file)

Description

get File Content

License

Open Source License

Declaration

public static String getFileContent(File file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {

    public static String getFileContent(File file) throws IOException {
        Long fileLengthLong = file.length();
        byte[] fileContent = new byte[fileLengthLong.intValue()];
        FileInputStream inputStream = new FileInputStream(file);
        inputStream.read(fileContent);/*  w w  w .j  a  v  a2 s .  co m*/
        inputStream.close();
        String string = new String(fileContent);
        return string;
    }
}

Related

  1. getFileContent(File f)
  2. getFileContent(File f)
  3. getFileContent(File file)
  4. getFileContent(File file)
  5. getFileContent(File file)
  6. getFileContent(File file)
  7. getFileContent(File file)
  8. getFileContent(File file)
  9. getFileContent(File file)