phelps.io

Class FileList

public class FileList extends Object

Operations on a list of files. Writing a Unix find is just some tests inside an iterator loop.

Version: $Revision: 1.11 $ $Date: 2003/08/07 03:27:42 $

See Also: java.io.File FileFilterPattern

Constructor Summary
FileList(String base, FileFilter filter)
FileList(String[] base, FileFilter filter)
FileList(String[] base, int start, FileFilter filter)
Part of base starting from start, for use by command-line commands that process the rest of String[] argv after options.
FileList(File base, FileFilter filter)
FileList(File[] base, FileFilter filter)
Method Summary
voidaddFile(File f)
Iterator<File>breadthFirstIterator()
Iterates over all passed files and recursively all files in base directories in breadth-first order.
voidcopy(File dirout)
Copy all files to destination directory dirout.
booleandelete()
Delete all files.
Iterator<File>depthFirstIterator()
Iterates over all passed files and recursively all files in base directories in depth-first order.
Iterator<File>iterator()
The iterator for java.lang.Iterable and the enchanced for loop is depthFirstIterator.
longlength()
Returns total length of files in group.
File[]listFiles()
voidsetDirsFirst(boolean b)
If true, reports, per directory, all the subdirectories then the rest of the files.
voidsetRecurse(boolean b)
If true, recurses through directories to collect files.
voidsetSorted(boolean b)
If true sorts filenames, per directory, in Strings#DICTIONARY_CASE_INSENSITIVE_ORDER case-insensitive dictionary order.

Constructor Detail

FileList

public FileList(String base, FileFilter filter)

FileList

public FileList(String[] base, FileFilter filter)

FileList

public FileList(String[] base, int start, FileFilter filter)
Part of base starting from start, for use by command-line commands that process the rest of String[] argv after options.

FileList

public FileList(File base, FileFilter filter)

FileList

public FileList(File[] base, FileFilter filter)

Method Detail

addFile

public void addFile(File f)

breadthFirstIterator

public Iterator<File> breadthFirstIterator()
Iterates over all passed files and recursively all files in base directories in breadth-first order. This method is memory efficient: it does not first build up a list of all files. There can be any number of iterators active at once on the same FileLists object.

copy

public void copy(File dirout)
Copy all files to destination directory dirout.

delete

public boolean delete()
Delete all files.

Returns: true if successfully deleted all files

depthFirstIterator

public Iterator<File> depthFirstIterator()
Iterates over all passed files and recursively all files in base directories in depth-first order. This method is memory efficient: it does not first build up a list of all files. There can be any number of iterators active at once on the same FileList object.

iterator

public Iterator<File> iterator()
The iterator for java.lang.Iterable and the enchanced for loop is depthFirstIterator.

length

public long length()
Returns total length of files in group.

listFiles

public File[] listFiles()

setDirsFirst

public void setDirsFirst(boolean b)
If true, reports, per directory, all the subdirectories then the rest of the files.

setRecurse

public void setRecurse(boolean b)
If true, recurses through directories to collect files.

setSorted

public void setSorted(boolean b)
If true sorts filenames, per directory, in Strings#DICTIONARY_CASE_INSENSITIVE_ORDER case-insensitive dictionary order.