Java InputStreamReader Read readFile(String path)

Here you can find the source of readFile(String path)

Description

read File

License

Open Source License

Declaration

public static ArrayList<String> readFile(String path) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static ArrayList<String> readFile(String path) throws Exception {
        ArrayList<String> result = new ArrayList<String>();
        InputStreamReader isReader = new InputStreamReader(new FileInputStream(path), "UTF-8");
        BufferedReader reader = new BufferedReader(isReader);
        String aline;/*from w  ww  . j ava 2  s. c  o  m*/
        while ((aline = reader.readLine()) != null) {
            result.add(aline);
        }
        reader.close();
        return result;
    }
}

Related

  1. readFile(String path)
  2. readFile(String path)
  3. readFile(String Path)
  4. readFile(String path)
  5. readFile(String path)
  6. readFile(String path, String charset)
  7. readFile(ZipInputStream zin)
  8. readFileAddLine(String filePath, Object object)
  9. readFileAll(File file, String charsetName)