Java BufferedReader Read readFile(final File argFile)

Here you can find the source of readFile(final File argFile)

Description

Return a list of Strings, one per line of the file.

License

Open Source License

Declaration

public static List<String> readFile(final File argFile) throws IOException 

Method Source Code


//package com.java2s;
//License from project: GNU General Public License 

import java.io.BufferedReader;

import java.io.File;
import java.io.FileReader;

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /** Return a list of Strings, one per line of the file. */
    public static List<String> readFile(final File argFile) throws IOException {
        final BufferedReader br = new BufferedReader(new FileReader(argFile));
        String line;//  w  w  w  . j  a  v  a 2s .  com

        List<String> lines = new ArrayList<>();
        while ((line = br.readLine()) != null) {
            lines.add(line);
        }
        br.close();
        return lines;
    }
}

Related

  1. readFile(File in)
  2. readFile(File inputFile)
  3. readFile(File location)
  4. readFile(File path)
  5. readFile(File testPage)
  6. readFile(final File file)
  7. readFile(final File file)
  8. readFile(final File file)
  9. readFile(final File file)