Java BufferedReader Read All readAll(String fileName)

Here you can find the source of readAll(String fileName)

Description

read All

License

Open Source License

Declaration

public static Set<String> readAll(String fileName) throws IOException 

Method Source Code

//package com.java2s;

import java.io.BufferedReader;

import java.io.FileReader;
import java.io.IOException;

import java.util.HashSet;
import java.util.Set;

public class Main {
    public static Set<String> readAll(String fileName) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader(fileName));
        Set<String> s = new HashSet<String>();
        String line;/* w ww .  java  2  s  .c  o m*/
        while ((line = reader.readLine()) != null) {
            if (!"".equals(line)) {
                s.add(line);
            }
        }
        return s;
    }
}

Related

  1. readAll(InputStream stream)
  2. readAll(Reader reader)
  3. readAll(Reader reader)
  4. readAll(Reader reader)
  5. readAll(Reader reader)
  6. readAll(String fileName)
  7. readAll(String filePath)
  8. readAll(String filePathAndName)
  9. readAll(String ip)