Here you can find the source of readFileData(String directoryLocation, String fileName)
@SuppressWarnings("resource") public static List<String> readFileData(String directoryLocation, String fileName)
//package com.java2s; /**/*from w w w . j ava2 s.co m*/ * Copyright (c) {2011} {meter@rbtsb.com} { * individual contributors as indicated by the @authors tag}. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Private License v1.0 * which accompanies this distribution, and is available at * http://www.rbtsb.com */ import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { @SuppressWarnings("resource") public static List<String> readFileData(String directoryLocation, String fileName) { FileInputStream fstream = null; List<String> contents = null; try { fstream = new FileInputStream(directoryLocation.concat(fileName)); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; contents = new ArrayList<String>(); try { while ((strLine = br.readLine()) != null) { contents.add(strLine); } } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } return contents; } }