Java BufferedReader Read loadToStringListFromFile(String fullFileName)

Here you can find the source of loadToStringListFromFile(String fullFileName)

Description

load To String List From File

License

LGPL

Declaration

public static List<String> loadToStringListFromFile(String fullFileName)
            throws Exception 

Method Source Code

//package com.java2s;
/*/*from   w ww  . jav a 2  s  . co m*/
 *   This software is distributed under the terms of the FSF
 *   Gnu Lesser General Public License (see lgpl.txt).
 *
 *   This program is distributed WITHOUT ANY WARRANTY. See the
 *   GNU General Public License for more details.
 */

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.InputStreamReader;

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> loadToStringListFromFile(String fullFileName)
            throws Exception {
        List<String> lines = new ArrayList<String>();
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(
                    new FileInputStream(fullFileName), "utf-8"));
            while (true) {
                String line = br.readLine();
                if (line == null)
                    break;
                lines.add(line);
            }
        } catch (Exception ex) {
            throw ex;
        } finally {
            try {
                if (br != null)
                    br.close();
            } catch (Exception ex) {
            }
        }
        return lines;
    }
}

Related

  1. loadTemplate(final String resource)
  2. loadTemplate(String templateUrl)
  3. loadTemplateParametersFile(File f)
  4. loadTestFixture(String path)
  5. loadTestUserEventRelation(String eventFilePath, HashMap> TestUser2EventIndexSetMap)
  6. loadTrustDistrustSets(String trust_data_set)
  7. loadTrustSet(String trustSet)
  8. loadTwoColumnResource(InputStream resource)
  9. loadTxnDescriptions(String filename)