Java BufferedReader Read readFile(File f)

Here you can find the source of readFile(File f)

Description

read File

License

Open Source License

Declaration

public static String readFile(File f) throws Exception 

Method Source Code


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

import java.io.BufferedReader;
import java.io.File;

import java.io.FileReader;

public class Main {
    public static String readFile(File f) throws Exception {

        String res = "";

        BufferedReader br = null;
        br = new BufferedReader(new FileReader(f));
        String line = null;//w w  w  .  ja va2  s . co  m

        while ((line = br.readLine()) != null) {
            res += line;
        }

        try {
            br.close();
        } catch (Exception e) {
        }

        return res;
    }
}

Related

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