Java BufferedReader Read loadDataURLs(File f, Pattern p)

Here you can find the source of loadDataURLs(File f, Pattern p)

Description

load Data UR Ls

License

Open Source License

Declaration

public static Collection<String> loadDataURLs(File f, Pattern p) 

Method Source Code

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

import java.io.BufferedReader;
import java.io.File;

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

import java.util.Collection;

import java.util.TreeSet;
import java.util.regex.Pattern;

public class Main {
    public static Collection<String> loadDataURLs(File f, Pattern p) {
        Collection<String> s = new TreeSet<String>();
        try {/*from   ww w.  j  a  va2  s .  c  om*/
            BufferedReader r = null;
            try {
                r = new BufferedReader(new FileReader(f));

                String sLine;
                while ((sLine = r.readLine()) != null) {
                    sLine = sLine.trim();
                    if (sLine.isEmpty() || sLine.startsWith("#")) {
                        continue;
                    }
                    if ((p != null) && !p.matcher(sLine).matches()) {
                        continue;
                    }

                    s.add(sLine);
                }
            } finally {
                if (r != null) {
                    r.close();
                }
            }
        } catch (IOException e) {
        }

        return s;
    }
}

Related

  1. loadConfig(File conf)
  2. loadConfigProps(String configFile)
  3. loadContents(File file)
  4. loadCredentials(File credentials)
  5. loadCsvFile(String fileWithPath, String delimiter)
  6. loadDict(InputStream io, boolean case_sensitive)
  7. loadEnrichmentHits(File file)
  8. loadIgnorList()
  9. loadInputStream(InputStream inputStream)