org.jboss.jsfunit.analysis.util
Class FileUtils

java.lang.Object
  extended by org.jboss.jsfunit.analysis.util.FileUtils

public class FileUtils
extends Object

Utility class for file handling.

Version:
$$Revision: $$
Author:
Alexander Jesse

Nested Class Summary
static class FileUtils.FileExtensionFilter
          A FilenameFilter implementation that accepts all files that have an extension from a list passed into this filter.
static class FileUtils.FolderFilter
          A FileFilter that accepts all folders.
 
Constructor Summary
FileUtils()
           
 
Method Summary
static String extractExtension(String fileName)
          Extract the file-extension
static List<String> findFiles(File folder, List<String> allowedExtensions)
          Find all files in the passed in directory.
static List<String> findFiles(String folderPath, List<String> allowedExtensions)
          Find all files in the passed in directory.
static List<String> findFilesRecursive(File rootFolder, List<String> allowedExtensions)
          Find all files in the passed in directory and all sub-directories.
static List<String> findFilesRecursive(String rootPath, List<String> allowedExtensions)
          Find all files in the passed in directory and all sub-directories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

findFilesRecursive

public static List<String> findFilesRecursive(String rootPath,
                                              List<String> allowedExtensions)
Find all files in the passed in directory and all sub-directories.

Parameters:
rootPath - path of the root-directory
allowedExtensions - list off allowed file extensions
Returns:
a list of file-paths

findFilesRecursive

public static List<String> findFilesRecursive(File rootFolder,
                                              List<String> allowedExtensions)
Find all files in the passed in directory and all sub-directories.

Parameters:
rootFolder - path of the root-directory
allowedExtensions - list off allowed file extensions
Returns:
a list of file-paths

findFiles

public static List<String> findFiles(String folderPath,
                                     List<String> allowedExtensions)
Find all files in the passed in directory.

Parameters:
folderPath - path of the root-directory
allowedExtensions - list off allowed file extensions
Returns:
a list of file-paths

findFiles

public static List<String> findFiles(File folder,
                                     List<String> allowedExtensions)
Find all files in the passed in directory.

Parameters:
folder - File object of a folder
allowedExtensions - list off allowed file extensions
Returns:
a list of file-paths

extractExtension

public static String extractExtension(String fileName)
Extract the file-extension

Parameters:
fileName - the file name
Returns:
empty string (if no extension) or the files extension


Copyright © 2007-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.