Here you can find the source of readAll(File file)
public static List<String> readAll(File file)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readAll(File file) { List<String> data = new ArrayList<>(); if (file.isDirectory() || !file.canRead() || !file.exists() || file.isHidden()) return data; try (BufferedReader br = new BufferedReader(new FileReader(file))) { String read = null;// w w w . j a v a 2s.c o m while ((read = br.readLine()) != null) data.add(read); } catch (Exception e) { e.printStackTrace(); } return data; } }