Java Text File Read Line readLines(String fileName)

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

Description

read Lines

License

Open Source License

Declaration

public static List<String> readLines(String fileName) throws IOException 

Method Source Code


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

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static List<String> readLines(String fileName) throws IOException {
        List<String> lines = new ArrayList<String>();
        try (InputStream in = new FileInputStream(fileName);
                BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
            String line = null;// w  w  w.j  a  va 2s . c o  m
            while ((line = br.readLine()) != null) {
                lines.add(line);
            }
        }
        return lines;
    }
}

Related

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