util
Class FileRetriever

java.lang.Object
  extended by util.FileRetriever

public class FileRetriever
extends Object

A helper class with static methods to retrieve a list of files. The file names are either given as a comma-separated string or reside one-per-line in a text file.


Constructor Summary
FileRetriever()
           
 
Method Summary
static List<File> loadAsFiles(String path, File listfile)
          Retrieves a list of files from a file.
static List<File> tokenizeAsFiles(String path, String comma)
          Retrieves a list of files from a comma separated list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileRetriever

public FileRetriever()
Method Detail

loadAsFiles

public static List<File> loadAsFiles(String path,
                                     File listfile)
Retrieves a list of files from a file. Each line read in the input file is considered to be a filename. Lines starting with AsciiReader.COMMENT are ignored. To provide the possibility to supply only file names (without parent paths) in the list file, an additional path string can be supplied. This path string, together with the file name read in from the file is used to construct a file, following the FileAccess.fromName(java.lang.String, java.lang.String) contract. If the target file cannot be found or read, null is returned. If the target list file is empty or consists of only comment lines an empty list is returned.

Parameters:
path - The path to add to all names found in the list file.
listfile - A list of all file names, without path.
Returns:
A List of Files

tokenizeAsFiles

public static List<File> tokenizeAsFiles(String path,
                                         String comma)
Retrieves a list of files from a comma separated list. Note that the comma is not a valid part of a file name in this version, as it is used as a separateor char.

Returns:
A list of files.