Here you can find the source of readLines(File file)
public static ArrayList<String> readLines(File file) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.ArrayList; public class Main { private static final String NEWLINE = System.lineSeparator(); public static ArrayList<String> readLines(File file) throws FileNotFoundException, IOException { ArrayList<String> lines = new ArrayList<>(); try (BufferedReader br = new BufferedReader(new FileReader(file))) { String ln;// w ww.ja v a 2 s. c om while ((ln = br.readLine()) != null) lines.add(ln); } return lines; } public static String readLine(RandomAccessFile wiki) throws IOException { long start = wiki.getFilePointer(); wiki.readLine(); long end = wiki.getFilePointer(); wiki.seek(start); byte[] b = new byte[(int) (end - start)]; wiki.read(b); return new String(b).replace(System.lineSeparator(), ""); } public static String read(String file) throws FileNotFoundException, IOException { try (BufferedReader br = new BufferedReader(new FileReader(file))) { return read(br); } } public static String read(BufferedReader br) throws IOException { StringBuffer sbuff = new StringBuffer(); String ln; while ((ln = br.readLine()) != null) sbuff.append(ln).append(NEWLINE); return sbuff.toString(); } }