org.expasy.jpl.commons.base.io
Class FileFinder

java.lang.Object
  extended by org.expasy.jpl.commons.base.io.FileFinder

public final class FileFinder
extends Object

Class to find all files matching a regular expression in a directory tree.

Version:
1.0
Author:
Markus Muller

Constructor Summary
FileFinder()
           
 
Method Summary
static List<File> getFiles(String root, Pattern pattern)
           
static List<File> getFiles(String root, Pattern pattern, boolean recurse)
          Find all files in the directory sub-tree under root
static List<File> getFiles(String root, String regex)
           
static List<File> getFiles(String root, String regex, boolean recurse)
          Find all files in the directory sub-tree under root
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileFinder

public FileFinder()
Method Detail

getFiles

public static List<File> getFiles(String root,
                                  String regex)
                           throws FileNotFoundException
Throws:
FileNotFoundException

getFiles

public static List<File> getFiles(String root,
                                  String regex,
                                  boolean recurse)
                           throws FileNotFoundException
Find all files in the directory sub-tree under root

Parameters:
root - Root directory for search
regex - Regular expression to match file name
recurse - recursive search if true
Returns:
List of matched files throws FileNotFoundException if root does not exist or is not a directory
Throws:
FileNotFoundException

getFiles

public static List<File> getFiles(String root,
                                  Pattern pattern)
                           throws FileNotFoundException
Throws:
FileNotFoundException

getFiles

public static List<File> getFiles(String root,
                                  Pattern pattern,
                                  boolean recurse)
                           throws FileNotFoundException
Find all files in the directory sub-tree under root

Parameters:
root - Root directory for search
pattern - Regular expression pattern to match file name
recurse - recursive search if true
Returns:
List of matched files throws FileNotFoundException if root does not exist or is not a directory
Throws:
FileNotFoundException


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.