Here you can find the source of readFileByChar(String path)
public static Set<String> readFileByChar(String path) throws Exception
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileReader; import java.util.HashSet; import java.util.Set; public class Main { public static Set<String> readFileByChar(String path) throws Exception { Set<String> datas = new HashSet<String>(); FileReader fr = new FileReader(path); BufferedReader br = new BufferedReader(fr); String line = null;/*from w w w .j a va 2 s. c om*/ while ((line = br.readLine()) != null) { datas.add(line); } br.close(); fr.close(); return datas; } }