Java InputStreamReader Read readFileToList(String fileName, String codeing)

Here you can find the source of readFileToList(String fileName, String codeing)

Description

read File To List

License

Open Source License

Declaration

public static List<String> readFileToList(String fileName, String codeing) 

Method Source Code

//package com.java2s;

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> readFileToList(String fileName, String codeing) {
        List<String> list = new ArrayList<String>();
        try {/*from   w  w  w  .  j a v  a 2  s .c  om*/
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(new FileInputStream(fileName), codeing));
            String data = null;
            do {
                data = reader.readLine();
                if (data == null)
                    break;
                else {
                    list.add(data);
                }
            } while (true);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return list;
    }
}

Related

  1. readFileOneLine(String filename, String keyInLine)
  2. readFileOrResource(String source)
  3. readFiles(String[] files, String encoding)
  4. readFileSB(File f)
  5. readFileToLines(File file)
  6. readFileToSet(String filePath, String fileEncoding)
  7. readFileUtf8(IFile file)
  8. readFileWithThrow(IFile in)