Java BufferedReader Read readFile(String fileDir)

Here you can find the source of readFile(String fileDir)

Description

read File

License

Open Source License

Declaration

public static List<String> readFile(String fileDir) throws Exception 

Method Source Code


//package com.java2s;
import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> readFile(String fileDir) throws Exception {
        File file = new File(fileDir);
        List<String> fileList = new ArrayList<String>();
        if (!file.exists()) {
            System.err.println("File Not exist!");
        }/*from  w w w.j a va 2 s .co m*/
        FileReader fileReader = new FileReader(file);
        BufferedReader br = new BufferedReader(fileReader);
        String strLine = "";
        while ((strLine = br.readLine()) != null) {
            fileList.add(strLine);
        }
        return fileList;
    }
}

Related

  1. readFile(String file)
  2. readFile(String file)
  3. readFile(String file)
  4. readFile(String file)
  5. readFile(String file, Boolean deleteOnExit)
  6. readFile(String filename)
  7. readFile(String filename)
  8. readfile(String filename)
  9. readFile(String fileName)