Java BufferedReader Read Line readLine(File f)

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

Description

read Line

License

Apache License

Declaration

public static List<String> readLine(File f) 

Method Source Code

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

import java.io.BufferedReader;

import java.io.File;
import java.io.FileInputStream;

import java.io.IOException;

import java.io.InputStreamReader;

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static List<String> readLine(File f) {
        List<String> result = new ArrayList<String>();
        BufferedReader reader = null;
        try {/*w w w.j  a va 2  s  . c om*/
            reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), "utf-8"));
            String line = null;
            while ((line = reader.readLine()) != null)
                result.add(line);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        return result;
    }
}

Related

  1. readLine(BufferedReader input)
  2. readLine(BufferedReader reader)
  3. readLine(BufferedReader reader)
  4. readLine(BufferedReader reader)
  5. readLine(BufferedReader reader, StringWriter writer)
  6. readLine(File f)
  7. readLine(File file)
  8. readLine(File file, int lineNumber)
  9. readLine(InputStream in)