@NotThreadSafe public class FileSystemRecursiveIterator extends Object implements IIterableIterator<File>
FileHelper.getDirectoryContent(File).| Constructor and Description |
|---|
FileSystemRecursiveIterator(File aBaseDir)
Constructor for recursively iterating a file system directory.
|
FileSystemRecursiveIterator(File aBaseDir,
IFileFilter aRecursionFilter)
Constructor for recursively iterating a file system directory.
|
FileSystemRecursiveIterator(String sBaseDir)
Constructor for recursively iterating a file system directory.
|
FileSystemRecursiveIterator(String sBaseDir,
IFileFilter aRecursionFilter)
Constructor for recursively iterating a file system directory.
|
| Modifier and Type | Method and Description |
|---|---|
static IIterableIterator<File> |
create(File fBaseDir,
IFileFilter... aFileFilters)
Create a new iterator that recursively descends into sub-directories
starting from the given base directory.
|
static IIterableIterator<File> |
create(File fBaseDir,
IFileFilter aFileFilter)
Create a new iterator that recursively descends into sub-directories
starting from the given base directory.
|
static IIterableIterator<File> |
create(String sBaseDir,
IFileFilter... aFileFilters)
Create a new iterator that recursively descends into sub-directories
starting from the given base directory.
|
static IIterableIterator<File> |
create(String sBaseDir,
IFileFilter aFileFilter)
Create a new iterator that recursively descends into sub-directories
starting from the given base directory.
|
int |
getLevel() |
IFileFilter |
getRecursionFilter() |
int |
getStartLevel() |
boolean |
hasNext() |
Iterator<File> |
iterator() |
File |
next() |
protected boolean |
recurseIntoDirectory(File aDirectory)
Override this method to manually filter the directories, which are recursed
into.
|
void |
remove() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorforEachRemainingpublic FileSystemRecursiveIterator(@Nonnull String sBaseDir)
sBaseDir - The base directory to start with. May not be null.public FileSystemRecursiveIterator(@Nonnull File aBaseDir)
aBaseDir - The base directory to start with. May not be null.public FileSystemRecursiveIterator(@Nonnull String sBaseDir, @Nullable IFileFilter aRecursionFilter)
sBaseDir - The base directory to start with. May not be null.aRecursionFilter - An optional filter that controls, into which sub-directories this
iterator should descend to. May be null.public FileSystemRecursiveIterator(@Nonnull File aBaseDir, @Nullable IFileFilter aRecursionFilter)
aBaseDir - The base directory to start with. May not be null.aRecursionFilter - An optional filter that controls, into which sub-directories this
iterator should descend to. May be null.@Nonnegative public int getStartLevel()
@Nullable public IFileFilter getRecursionFilter()
@OverrideOnDemand protected boolean recurseIntoDirectory(@Nonnull File aDirectory)
aDirectory - The non-null directorytrue if all children of this directory should be
investigated@Nonnull public final File next()
IIterableIterator@Nonnegative public final int getLevel()
next().
Always ≥ 0. The starting directory has level 0.@UnsupportedOperation public final void remove()
@Nonnull public static IIterableIterator<File> create(@Nonnull String sBaseDir, @Nonnull IFileFilter aFileFilter)
FilenameFilter can be added, that determines, which results to be
returned and which not. The difference between the filter passed here and
the filter that can be specified in the constructor is the following: the
IFilter in the constructor defines into which sub-directories to
descend. The FilenameFilter passed to this method only defines
which elements should be returned and which not, independent of the
iterated files (like a "view").sBaseDir - The base directory to start iterating. May not be null.aFileFilter - The file filter to be used. May not be null.null.@Nonnull public static IIterableIterator<File> create(@Nonnull File fBaseDir, @Nonnull IFileFilter aFileFilter)
FilenameFilter can be added, that determines, which results to be
returned and which not. The difference between the filter passed here and
the filter that can be specified in the constructor is the following: the
IFilter in the constructor defines into which sub-directories to
descend. The FilenameFilter passed to this method only defines
which elements should be returned and which not, independent of the
iterated files (like a "view").fBaseDir - The base directory to start iterating. May not be null.aFileFilter - The file filter to be used. May not be null.null.@Nonnull public static IIterableIterator<File> create(@Nonnull String sBaseDir, @Nonnull @Nonempty IFileFilter... aFileFilters)
FilenameFilters can be added, that determine, which results to be
returned and which not. The difference between the filter passed here and
the filter that can be specified in the constructor is the following: the
IFilter in the constructor defines into which sub-directories to
descend. The FilenameFilters passed to this method only define
which elements should be returned and which not, independent of the
iterated files (like a "view").sBaseDir - The base directory to start iterating. May not be null.aFileFilters - The file filter to be used. May neither be null nor
empty.null.@Nonnull public static IIterableIterator<File> create(@Nonnull File fBaseDir, @Nonnull @Nonempty IFileFilter... aFileFilters)
FilenameFilters can be added, that determine, which results to be
returned and which not. The difference between the filter passed here and
the filter that can be specified in the constructor is the following: the
IFilter in the constructor defines into which sub-directories to
descend. The FilenameFilters passed to this method only define
which elements should be returned and which not, independent of the
iterated files (like a "view").fBaseDir - The base directory to start iterating. May not be null.aFileFilters - The file filter to be used. May neither be null nor
empty.null.Copyright © 2014–2015 Philip Helger. All rights reserved.