下面列出了org.apache.commons.io.comparator.NameFileComparator#NAME_SYSTEM_COMPARATOR 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Construct an observer for the specified directory, file filter and
* file comparator.
*
* @param rootEntry the root directory to observe
* @param fileFilter The file filter or null if none
* @param caseSensitivity what case sensitivity to use comparing file names, null means system sensitive
*/
protected FileAlterationObserver(FileEntry rootEntry, FileFilter fileFilter, IOCase caseSensitivity) {
if (rootEntry == null) {
throw new IllegalArgumentException("Root entry is missing");
}
if (rootEntry.getFile() == null) {
throw new IllegalArgumentException("Root directory is missing");
}
this.rootEntry = rootEntry;
this.fileFilter = fileFilter;
if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
} else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
} else {
this.comparator = NameFileComparator.NAME_COMPARATOR;
}
}
/**
* Construct an observer for the specified directory, file filter and
* file comparator.
*
* @param rootEntry the root directory to observe
* @param fileFilter The file filter or null if none
* @param caseSensitivity what case sensitivity to use comparing file names, null means system sensitive
*/
protected FileAlterationObserver(final FileEntry rootEntry, final FileFilter fileFilter,
final IOCase caseSensitivity) {
if (rootEntry == null) {
throw new IllegalArgumentException("Root entry is missing");
}
if (rootEntry.getFile() == null) {
throw new IllegalArgumentException("Root directory is missing");
}
this.rootEntry = rootEntry;
this.fileFilter = fileFilter;
if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
} else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
} else {
this.comparator = NameFileComparator.NAME_COMPARATOR;
}
}
protected Comparator<File> convertSortOrder()
{
Comparator<File> result = NameFileComparator.NAME_COMPARATOR;
if ( getSortOrder().equalsIgnoreCase( "NAME_INSENSITIVE_COMPARATOR" ) )
{
result = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_INSENSITIVE_REVERSE" ) )
{
result = NameFileComparator.NAME_INSENSITIVE_REVERSE;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_REVERSE" ) )
{
result = NameFileComparator.NAME_REVERSE;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_SYSTEM_COMPARATOR" ) )
{
result = NameFileComparator.NAME_SYSTEM_COMPARATOR;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_SYSTEM_REVERSE" ) )
{
result = NameFileComparator.NAME_SYSTEM_REVERSE;
}
return result;
}