Java BufferedReader Read readFile(String path)

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

Description

read File

License

Apache License

Declaration

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

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static List<String> readFile(String path) throws Exception {

        List<String> lines = new ArrayList<String>();
        BufferedReader reader = new BufferedReader(new FileReader(path));
        String line = reader.readLine();
        while (line != null) {
            lines.add(line);/*from   ww  w.  j a  v a 2s .  com*/
            line = reader.readLine();
        }
        reader.close();
        return lines;
    }
}

Related

  1. readFile(String path)
  2. readFile(String path)
  3. readFile(String path)
  4. readFile(String path)
  5. readFile(String path)
  6. readFile(String path)
  7. readFile(String path)
  8. readFile(String path)
  9. readFile(String path)