Java File to Text Line fileToLines(String filename)

Here you can find the source of fileToLines(String filename)

Description

file To Lines

License

Open Source License

Declaration

private static List<String> fileToLines(String filename) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;
import java.util.*;

public class Main {
    private static List<String> fileToLines(String filename) {
        List<String> lines = new LinkedList<String>();
        String line = "";
        try {//w  w w  . ja va  2s.  c  o m
            BufferedReader in = new BufferedReader(new FileReader(filename));
            while ((line = in.readLine()) != null) {
                lines.add(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return lines;
    }
}

Related

  1. fileToLines(File file)
  2. fileToLines(String filename)
  3. fileToLines(String fileName)
  4. fileToLines(String filePath)