public class FileLister
extends java.lang.Object
implements java.io.Serializable, java.lang.Iterable<java.io.File>
Constructor and Description |
---|
FileLister()
Default constructor
|
FileLister(java.lang.String directory)
Constructor that loads all the files from the given directory
|
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<java.io.File> |
createNewListFromCount(int count)
Creates a new list of randomly chosen files of the given size from this fileLister
|
java.util.Iterator<java.io.File> |
createNewListFromPercent(double percent)
Creates a new list of randomly chosen files that is a percent of the files from this fileLister
|
java.lang.String |
getDirectory()
Provides the path to the directory used for the initial list of files
|
java.util.Map<java.lang.String,java.lang.Integer> |
getFileTypes()
Provides the counts for each file extension that exists in this list of files
|
java.util.Iterator<java.io.File> |
getNewListIterator()
Provides an iterator over the updated list of files; need to call
newCountIterator or
newPercentIterator to update the list of files |
int |
getNumberOfFiles()
Provides the size of the initial list of files
|
java.util.Iterator<java.io.File> |
iterator()
Provides an iterator over the list of files
|
void |
loadDirectory(java.lang.String directory)
Loads all the files from the given directory into the initial list of files
|
void |
printFiles()
Prints each file from the initial list of files to standard output
|
void |
recursiveLoadDirectory(java.lang.String directory)
Recursively loads all the files from the given directory into the initial list of files
|
public FileLister()
public FileLister(java.lang.String directory)
directory
- the string path to the directory to loadpublic java.util.Map<java.lang.String,java.lang.Integer> getFileTypes()
public java.util.Iterator<java.io.File> iterator()
iterator
in interface java.lang.Iterable<java.io.File>
public int getNumberOfFiles()
public java.lang.String getDirectory()
public java.util.Iterator<java.io.File> getNewListIterator()
newCountIterator
or
newPercentIterator
to update the list of filespublic void loadDirectory(java.lang.String directory)
directory
- the string path to the directory to loadpublic java.util.Iterator<java.io.File> createNewListFromCount(int count)
count
- the int
number of the files to includepublic java.util.Iterator<java.io.File> createNewListFromPercent(double percent)
percent
- the int
percent of the files to includepublic void printFiles()
public void recursiveLoadDirectory(java.lang.String directory)
directory
- the string path to the directory to load