Example usage for org.apache.commons.io.comparator NameFileComparator NameFileComparator

List of usage examples for org.apache.commons.io.comparator NameFileComparator NameFileComparator

Introduction

In this page you can find the example usage for org.apache.commons.io.comparator NameFileComparator NameFileComparator.

Prototype

public NameFileComparator() 

Source Link

Document

Construct a case sensitive file name comparator instance.

Usage

From source file:org.emonocot.harvest.common.DirectoryReader.java

@Override
public void open(ExecutionContext executionContext) throws ItemStreamException {
    File directory = new File(directoryName);
    if (directory.isDirectory()) {
        this.files = directory.listFiles((FileFilter) FileFilterUtils.fileFileFilter());
        if (files.length > 1) {
            Arrays.sort(files, new NameFileComparator());
        }//from www  . java 2 s .c o m
    } else {
        throw new IllegalArgumentException(directoryName + " is not a directory");
    }
    currentCount = executionContext.getInt(key, 0);
}