Here you can find the source of read(File file)
public static List<String> read(File file)
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> read(String pathName) { if (pathName != null) { try { return readFree(new File(pathName)); } catch (FileNotFoundException e) { e.printStackTrace();/* w ww . j a v a 2s . co m*/ } catch (IOException e) { e.printStackTrace(); } } return null; } public static List<String> read(File file) { if (file != null) { try { return readFree(file); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } return null; } private static List<String> readFree(File file) throws IOException { List<String> archive = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new FileReader(file)); String s; do { s = reader.readLine(); if (s != null) { archive.add(s); } } while (s != null); reader.close(); return archive; } }