Java BufferedReader Read loadList(File f, String enc)

Here you can find the source of loadList(File f, String enc)

Description

load List

License

Apache License

Declaration

public static List<String> loadList(File f, String enc) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;

import java.io.InputStreamReader;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> loadList(File f, String enc) throws Exception {
        List<String> ret = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), enc));
        try {/*from w  w w.  j  av a2 s .c o m*/
            String line = null;
            while ((line = br.readLine()) != null) {
                ret.add(line);
            }
        } finally {
            br.close();
        }
        return ret;
    }
}

Related

  1. loadLine(InputStream load)
  2. loadLineByLineAndTrim(String file_path)
  3. loadLines(InputStream in, List lines)
  4. loadLines(String file)
  5. loadLines(String fileName)
  6. loadList(final File file)
  7. loadList(String listName)
  8. loadListFromTextFile(String filename, String defaultitem, String linePrefix, String lineSuffix)
  9. loadLongArray(BufferedReader in)