Here you can find the source of readFile(String aFileName)
public static String[] readFile(String aFileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; public class Main { public static String[] readFile(String aFileName) throws IOException { File aFile = new File(aFileName); BufferedReader input = new BufferedReader(new FileReader(aFile)); ArrayList<String> outputBuffer = new ArrayList<String>(); try {/* w ww .j a v a2 s .c o m*/ String line = null; //not declared within while loop while ((line = input.readLine()) != null) { outputBuffer.add(line); } } finally { input.close(); } int nlines = outputBuffer.size(); String[] status = null; if (nlines < 1) { status = new String[1]; status[0] = ""; } else { status = new String[nlines]; for (int il = 0; il < nlines; ++il) { status[il] = outputBuffer.get(il); } } return status; } }