Here you can find the source of readAllLines(File inputFile)
public static List<String> readAllLines(File inputFile) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readAllLines(File inputFile) throws IOException { List<String> ret = new ArrayList<String>(); String line;//from ww w . jav a2s . c o m BufferedReader br = null; try { InputStream fis = new FileInputStream(inputFile); InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8")); br = new BufferedReader(isr); while ((line = br.readLine()) != null) { ret.add(line); } } finally { if (br != null) br.close(); } return ret; } }