public class ExplicitFileList extends FileList
Modifier and Type | Field and Description |
---|---|
private java.util.LinkedHashSet<java.lang.String> |
filenames
The list of explicit filenames.
|
private boolean |
sort
Flag indicating if the file list needs to be sorted or not.
|
Constructor and Description |
---|
ExplicitFileList(boolean caseSens)
Constructor which sets the case-sensitivity of the legacy operating system.
|
ExplicitFileList(ExplicitFileList ref)
Create a copy of the specified file list.
|
ExplicitFileList(java.lang.String[] filenames)
Common constructor which uses a case-insensitive sorting algorithm.
|
ExplicitFileList(java.lang.String[] filenames,
boolean caseSens)
Base constructor to handle all possible cases.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String file)
Add a single file to the
file list . |
void |
addAll(java.lang.String[] files)
Add the specified files to the
file list . |
protected void |
listImpl(java.util.List<java.io.File> results)
Core implementation of the listing algorithm which uses the
File class to create and return the list of files based
on user input specified during construction. |
static void |
main(java.lang.String[] args)
Provides a command line interface for an end user to drive and/or test
the ExplicitFileList class.
|
void |
removeAll(java.lang.String[] files)
Remove the specified files from the
file list . |
void |
setSort(boolean sort)
Set the
sort flag. |
protected void |
sortFiles(java.util.List<java.io.File> files)
Sort the files using a comparator which is aware of the
case sensitivity . |
isCaseSensitive, list, listFilenames, listFilenames, listWithSuffix, setCaseSensitive, size, withSuffix
private java.util.LinkedHashSet<java.lang.String> filenames
private boolean sort
public ExplicitFileList(boolean caseSens)
caseSens
- Sets the case-sensitivity of the sorting algorithm and legacy operating system.public ExplicitFileList(java.lang.String[] filenames, boolean caseSens)
filenames
- The array of absolute or relative file names.caseSens
- Sets the case-sensitivity of the sorting algorithm and legacy operating system.public ExplicitFileList(java.lang.String[] filenames)
filenames
- The array of absolute or relative file names.public ExplicitFileList(ExplicitFileList ref)
ref
- The reference instance.public void setSort(boolean sort)
sort
flag.sort
- Flag indicating if the file list needs to be sorted.public void addAll(java.lang.String[] files)
file list
.files
- The files to add.public void add(java.lang.String file)
file list
.file
- The file to add.public void removeAll(java.lang.String[] files)
file list
.files
- The files to remove.protected void listImpl(java.util.List<java.io.File> results)
File
class to create and return the list of files based
on user input specified during construction. No directories will be
returned in the list and only files that actually exist will be
returned. The resulting list will be sorted lexicographically.protected void sortFiles(java.util.List<java.io.File> files)
case sensitivity
.
This will be done only if sort
is true
public static void main(java.lang.String[] args)
stdout
.
Syntax:
java ExplcitFileList <filename> ...Where:
args
- List of command line arguments.