public class FileComparer extends Object implements Comparer, FilenameFilter, FilenameFilter
Modifier and Type | Field and Description |
---|---|
static char |
BackSlash |
boolean |
caseSensitive |
protected File |
check1 |
protected File |
check2 |
static char |
DriveSeparator |
static char |
ForwardSlash |
static int |
IGNORE_CASE |
boolean |
letAll |
protected Locale |
locale |
protected String |
mask |
static char |
MySeparator |
protected int |
options |
protected File |
parent |
protected Time |
time |
Constructor and Description |
---|
FileComparer(File parent,
Locale locale,
int options,
String mask) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(File dir,
Object nameOrFile) |
boolean |
accept(File dir,
String subfile)
This method determines whether or not a given file should be included
in a directory listing.
|
boolean |
accept(File dir,
String name) |
int |
compare(Object one,
Object two)
This should compare the two objects and return:
0 = the objects are equal.
|
static int |
findLastSeparator(String full) |
protected static int |
findLastSeparatorDrive(String full) |
static String |
getDrivePath(String full) |
static String |
getExt(String full) |
static String |
getFile(String full) |
static String |
getFileExt(String full) |
boolean |
matches(String fileName) |
void |
setMask(String mask) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public static char ForwardSlash
public static char BackSlash
public static char DriveSeparator
public static char MySeparator
public static final int IGNORE_CASE
protected String mask
protected File parent
protected int options
protected File check1
protected File check2
protected Locale locale
protected Time time
public boolean caseSensitive
public boolean letAll
public FileComparer(File parent, Locale locale, int options, String mask)
parent
- The parent file for the files to be compared.locale
- a Locale to use for comparisons.options
- This should be the File.LIST_XXX options.mask
- An optional mask for comparing a File with a mask.public void setMask(String mask)
public int compare(Object one, Object two)
Comparer
compare
in interface Comparer
compare
in interface Comparator
one
- the first objecttwo
- the second objectprotected static int findLastSeparatorDrive(String full)
public static int findLastSeparator(String full)
public boolean matches(String fileName)
public boolean accept(File dir, String subfile)
FilenameFilter
accept
in interface FilenameFilter
dir
- The File
instance for the directory being readsubfile
- The name of the file to testtrue
if the file should be included in the list,
false
otherwise.