Here you can find the source of loadDataURLs(File f, Pattern p)
public static Collection<String> loadDataURLs(File f, Pattern p)
//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; } }