Java Text File Read Line readLines(String filePath)

Here you can find the source of readLines(String filePath)

Description

read Lines

License

Apache License

Declaration

public static List<String> readLines(String filePath) 

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> readLines(String filePath) {

        try {//from ww  w  .  j av a2 s  .  c o m
            FileReader fr = new FileReader(filePath);
            BufferedReader br = new BufferedReader(fr);
            List<String> res = new ArrayList<>();
            String buf;
            while ((buf = br.readLine()) != null) {
                res.add(buf);
            }
            br.close();
            fr.close();
            return res;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. readLines(String filename)
  2. readLines(String filename)
  3. readLines(String filename)
  4. readLines(String fileName)
  5. readLines(String filePath)
  6. readLines(String filePath)
  7. readLines(String fullFileName)
  8. readLines(String lines)
  9. readLines(String string)