Here you can find the source of getFileContent(String path)
public static List<String> getFileContent(String path)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> getFileContent(String path) { List<String> strList = new ArrayList<String>(); try {/*from ww w. ja v a 2 s . c om*/ File file = new File(path); InputStreamReader read = new InputStreamReader(new FileInputStream(file), "UTF-8"); BufferedReader reader = new BufferedReader(read); String line; while ((line = reader.readLine()) != null) { strList.add(line); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return strList; } }