Here you can find the source of readFromFileToLineArray(File file)
public static ArrayList<String> readFromFileToLineArray(File file)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static ArrayList<String> readFromFileToLineArray(File file) { System.out.println("Debug: full input File Name " + file); ArrayList<String> lines = new ArrayList<String>(); // Open the file that is the first // command line parameter FileInputStream fstream = null; try {/* w ww .j ava 2 s . c om*/ fstream = new FileInputStream(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line try { while ((strLine = br.readLine()) != null) { lines.add(strLine); // Print the content on the console //System.out.println (strLine); } //Close the input stream in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return lines; } }